clang
3.7.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
work
release_test
rc4
llvm.src
tools
clang
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
#include <cstdarg>
15
16
namespace
clang {
17
namespace
ento {
18
19
static
inline
Selector
getKeywordSelectorImpl
(
ASTContext
&Ctx,
20
const
char
*First,
21
va_list
argp) {
22
SmallVector<IdentifierInfo*, 10>
II;
23
II.push_back(&Ctx.
Idents
.
get
(First));
24
25
while
(
const
char
*s =
va_arg
(argp,
const
char
*))
26
II.push_back(&Ctx.
Idents
.
get
(s));
27
28
return
Ctx.
Selectors
.
getSelector
(II.size(), &II[0]);
29
}
30
31
static
inline
Selector
getKeywordSelector
(
ASTContext
&Ctx,
va_list
argp) {
32
const
char
*First =
va_arg
(argp,
const
char
*);
33
assert(First &&
"keyword selectors must have at least one argument"
);
34
return
getKeywordSelectorImpl
(Ctx, First, argp);
35
}
36
37
LLVM_END_WITH_NULL
38
static
inline
Selector
getKeywordSelector
(
ASTContext
&Ctx,
39
const
char
*First, ...) {
40
va_list
argp;
41
va_start
(argp, First);
42
Selector
result =
getKeywordSelectorImpl
(Ctx, First, argp);
43
va_end
(argp);
44
return
result;
45
}
46
47
LLVM_END_WITH_NULL
48
static
inline
void
lazyInitKeywordSelector
(
Selector
&Sel,
ASTContext
&Ctx,
49
const
char
*First, ...) {
50
if
(!Sel.
isNull
())
51
return
;
52
va_list
argp;
53
va_start
(argp, First);
54
Sel =
getKeywordSelectorImpl
(Ctx, First, argp);
55
va_end
(argp);
56
}
57
58
static
inline
void
lazyInitNullarySelector
(
Selector
&Sel,
ASTContext
&Ctx,
59
const
char
*Name) {
60
if
(!Sel.
isNull
())
61
return
;
62
Sel =
GetNullarySelector
(Name, Ctx);
63
}
64
65
}
// end namespace ento
66
}
// end namespace clang
67
68
#endif
ASTContext.h
Defines the clang::ASTContext interface.
clang::GetNullarySelector
static Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
Definition:
ASTContext.h:2477
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition:
IdentifierTable.h:596
va_end
#define va_end(ap)
Definition:
stdarg.h:34
clang::ento::getKeywordSelector
static Selector getKeywordSelector(ASTContext &Ctx, va_list argp)
Definition:
SelectorExtras.h:31
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:89
clang::Selector::isNull
bool isNull() const
Determine whether this is the empty selector.
Definition:
IdentifierTable.h:658
clang::ASTContext::Idents
IdentifierTable & Idents
Definition:
ASTContext.h:439
clang::ento::lazyInitNullarySelector
static void lazyInitNullarySelector(Selector &Sel, ASTContext &Ctx, const char *Name)
Definition:
SelectorExtras.h:58
clang::ento::getKeywordSelectorImpl
static Selector getKeywordSelectorImpl(ASTContext &Ctx, const char *First, va_list argp)
Definition:
SelectorExtras.h:19
va_arg
#define va_arg(ap, type)
Definition:
stdarg.h:35
clang::ento::lazyInitKeywordSelector
static LLVM_END_WITH_NULL void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx, const char *First,...)
Definition:
SelectorExtras.h:48
clang::ASTContext::Selectors
SelectorTable & Selectors
Definition:
ASTContext.h:440
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition:
IdentifierTable.h:444
llvm::SmallVector
Definition:
LLVM.h:34
va_start
#define va_start(ap, param)
Definition:
stdarg.h:33
va_list
__builtin_va_list va_list
Definition:
stdarg.h:30
clang::SelectorTable::getSelector
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
Definition:
IdentifierTable.cpp:603
Generated on Mon Aug 31 2015 10:45:23 for clang by
1.8.6