1 //=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
11 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
13 #include "clang/AST/ASTContext.h"
18 template <typename... IdentifierInfos>
19 static inline Selector getKeywordSelector(ASTContext &Ctx,
20 IdentifierInfos *... IIs) {
21 static_assert(sizeof...(IdentifierInfos),
22 "keyword selectors must have at least one argument");
23 SmallVector<IdentifierInfo *, 10> II({&Ctx.Idents.get(IIs)...});
25 return Ctx.Selectors.getSelector(II.size(), &II[0]);
28 template <typename... IdentifierInfos>
29 static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx,
30 IdentifierInfos *... IIs) {
33 Sel = getKeywordSelector(Ctx, IIs...);
36 static inline void lazyInitNullarySelector(Selector &Sel, ASTContext &Ctx,
40 Sel = GetNullarySelector(Name, Ctx);
43 } // end namespace ento
44 } // end namespace clang