clang 19.0.0git
SelectorExtras.h
Go to the documentation of this file.
1//=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_ANALYSIS_SELECTOREXTRAS_H
10#define LLVM_CLANG_ANALYSIS_SELECTOREXTRAS_H
11
13
14namespace clang {
15
16template <typename... IdentifierInfos>
18 const IdentifierInfos *...IIs) {
19 static_assert(sizeof...(IdentifierInfos) > 0,
20 "keyword selectors must have at least one argument");
22
23 return Ctx.Selectors.getSelector(II.size(), &II[0]);
24}
25
26template <typename... IdentifierInfos>
27static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx,
28 IdentifierInfos *... IIs) {
29 if (!Sel.isNull())
30 return;
31 Sel = getKeywordSelector(Ctx, IIs...);
32}
33
34} // end namespace clang
35
36#endif
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:185
IdentifierTable & Idents
Definition: ASTContext.h:647
SelectorTable & Selectors
Definition: ASTContext.h:648
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Smart pointer class that efficiently represents Objective-C method names.
bool isNull() const
Determine whether this is the empty selector.
The JSON file list parser is used to communicate input to InstallAPI.
static Selector getKeywordSelector(ASTContext &Ctx, const IdentifierInfos *...IIs)
static void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx, IdentifierInfos *... IIs)