Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:27

0001 //=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_ANALYSIS_SELECTOREXTRAS_H
0010 #define LLVM_CLANG_ANALYSIS_SELECTOREXTRAS_H
0011 
0012 #include "clang/AST/ASTContext.h"
0013 
0014 namespace clang {
0015 
0016 template <typename... IdentifierInfos>
0017 static inline Selector getKeywordSelector(ASTContext &Ctx,
0018                                           const IdentifierInfos *...IIs) {
0019   static_assert(sizeof...(IdentifierInfos) > 0,
0020                 "keyword selectors must have at least one argument");
0021   SmallVector<const IdentifierInfo *, 10> II({&Ctx.Idents.get(IIs)...});
0022 
0023   return Ctx.Selectors.getSelector(II.size(), &II[0]);
0024 }
0025 
0026 template <typename... IdentifierInfos>
0027 static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx,
0028                                            IdentifierInfos *... IIs) {
0029   if (!Sel.isNull())
0030     return;
0031   Sel = getKeywordSelector(Ctx, IIs...);
0032 }
0033 
0034 } // end namespace clang
0035 
0036 #endif