clang: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
14#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
15
21#include
22#include
23
25
30
31namespace ento {
32
39 return true;
40
43 return true;
44
45 return false;
46}
47
48std::pair<const clang::VarDecl *, const clang::Expr *>
50
51
52
53
54
55
56
66
67
69
70
71
72
73
75
77 union {
80 } Op;
81 bool IsBinary;
82
83public:
87
89 assert(IsBinary && "cannot get binary operator - we have a unary operator");
90 return Op.Bin;
91 }
92
93 std::optional GetBinaryOp() const {
94 if (IsBinary)
95 return Op.Bin;
96 return {};
97 }
98
100 assert(!IsBinary &&
101 "cannot get unary operator - we have a binary operator");
102 return Op.Un;
103 }
104
105 std::optional GetUnaryOp() const {
106 if (!IsBinary)
107 return Op.Un;
108 return {};
109 }
110};
111
113 bool IsBinary);
114
116
117
118
120
121}
122
123}
124
125#endif
Defines an enumeration for C++ overloaded operators.
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A (possibly-)qualified type.
Stmt - This represents one statement.
The base class of the type hierarchy.
Represents a variable declaration or definition.
UnaryOperatorKind GetUnaryOpUnsafe() const
Definition CheckerHelpers.h:99
BinaryOperatorKind GetBinaryOpUnsafe() const
Definition CheckerHelpers.h:88
std::optional< UnaryOperatorKind > GetUnaryOp() const
Definition CheckerHelpers.h:105
OperatorKind(UnaryOperatorKind Un)
Definition CheckerHelpers.h:85
UnaryOperatorKind Un
Definition CheckerHelpers.h:79
OperatorKind(BinaryOperatorKind Bin)
Definition CheckerHelpers.h:84
bool IsBinaryOp() const
Definition CheckerHelpers.h:86
BinaryOperatorKind Bin
Definition CheckerHelpers.h:78
std::optional< BinaryOperatorKind > GetBinaryOp() const
Definition CheckerHelpers.h:93
Nullability
Definition CheckerHelpers.h:57
@ Nullable
Definition CheckerHelpers.h:62
@ Unspecified
Definition CheckerHelpers.h:63
@ Contradicted
Definition CheckerHelpers.h:58
@ Nonnull
Definition CheckerHelpers.h:64
bool containsEnum(const Stmt *S)
Nullability getNullabilityAnnotation(QualType Type)
Get nullability annotation for a given type.
bool isWithinStdNamespace(const Decl *D)
Returns true if declaration D is in std namespace or any nested namespace or class scope.
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
bool containsStaticLocal(const Stmt *S)
std::pair< const clang::VarDecl *, const clang::Expr * > parseAssignment(const Stmt *S)
OperatorKind operationKindFromOverloadedOperator(OverloadedOperatorKind OOK, bool IsBinary)
bool containsBuiltinOffsetOf(const Stmt *S)
std::optional< SVal > getPointeeVal(SVal PtrSVal, ProgramStateRef State)
std::optional< int > tryExpandAsInteger(StringRef Macro, const Preprocessor &PP)
Try to parse the value of a defined preprocessor macro.
bool containsStmt(const Stmt *S)
Definition CheckerHelpers.h:37
bool containsMacro(const Stmt *S)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)