clang
7.0.0
lib
StaticAnalyzer
Checkers
SelectorExtras.h
Go to the documentation of this file.
1
//=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
11
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
12
13
#include "
clang/AST/ASTContext.h
"
14
15
namespace
clang
{
16
namespace
ento {
17
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)...});
24
25
return
Ctx.
Selectors
.
getSelector
(II.size(), &II[0]);
26
}
27
28
template
<
typename
... IdentifierInfos>
29
static
inline
void
lazyInitKeywordSelector
(
Selector
&Sel,
ASTContext
&Ctx,
30
IdentifierInfos *... IIs) {
31
if
(!Sel.
isNull
())
32
return
;
33
Sel =
getKeywordSelector
(Ctx, IIs...);
34
}
35
36
static
inline
void
lazyInitNullarySelector
(
Selector
&Sel,
ASTContext
&Ctx,
37
const
char
*Name) {
38
if
(!Sel.
isNull
())
39
return
;
40
Sel =
GetNullarySelector
(Name, Ctx);
41
}
42
43
}
// end namespace ento
44
}
// end namespace clang
45
46
#endif
ASTContext.h
Defines the clang::ASTContext interface.
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition:
IdentifierTable.h:654
clang::ento::lazyInitKeywordSelector
static void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx, IdentifierInfos *... IIs)
Definition:
SelectorExtras.h:29
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:150
clang::ento::getKeywordSelector
static Selector getKeywordSelector(ASTContext &Ctx, IdentifierInfos *... IIs)
Definition:
SelectorExtras.h:19
clang::ASTContext::Idents
IdentifierTable & Idents
Definition:
ASTContext.h:545
clang::GetNullarySelector
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
Definition:
ASTContext.h:2932
clang::ento::lazyInitNullarySelector
static void lazyInitNullarySelector(Selector &Sel, ASTContext &Ctx, const char *Name)
Definition:
SelectorExtras.h:36
clang::ASTContext::Selectors
SelectorTable & Selectors
Definition:
ASTContext.h:546
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition:
IdentifierTable.h:500
llvm::SmallVector
Definition:
LLVM.h:36
clang
Dataflow Directional Tag Classes.
Definition:
CFGReachabilityAnalysis.h:22
clang::SelectorTable::getSelector
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
Definition:
IdentifierTable.cpp:661
clang::Selector::isNull
bool isNull() const
Determine whether this is the empty selector.
Definition:
IdentifierTable.h:721
Generated on Mon Sep 17 2018 14:02:11 for clang by
1.8.13