20 if (S->getLocStart().isMacroID())
23 if (S->getLocEnd().isMacroID())
26 for (
const Stmt *Child : S->children())
37 if (DR && isa<EnumConstantDecl>(DR->
getDecl()))
40 for (
const Stmt *Child : S->children())
53 if (VD->isStaticLocal())
56 for (
const Stmt *Child : S->children())
65 if (isa<OffsetOfExpr>(S))
68 for (
const Stmt *Child : S->children())
76 std::pair<const clang::VarDecl *, const clang::Expr *>
79 const Expr *RHS =
nullptr;
81 if (
auto Assign = dyn_cast_or_null<BinaryOperator>(S)) {
82 if (Assign->isAssignmentOp()) {
84 RHS = Assign->getRHS();
85 if (
auto DE = dyn_cast_or_null<DeclRefExpr>(Assign->getLHS()))
86 VD = dyn_cast_or_null<VarDecl>(DE->getDecl());
88 }
else if (
auto PD = dyn_cast_or_null<DeclStmt>(S)) {
90 assert(PD->isSingleDecl() &&
"We process decls one by one");
91 VD = dyn_cast_or_null<VarDecl>(PD->getSingleDecl());
92 RHS = VD->getAnyInitializer();
95 return std::make_pair(VD, RHS);
bool containsStaticLocal(const Stmt *S)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool containsBuiltinOffsetOf(const Stmt *S)
std::pair< const clang::VarDecl *, const clang::Expr * > parseAssignment(const Stmt *S)
Expr - This represents one expression.
bool containsMacro(const Stmt *S)
A reference to a declared variable, function, enum, etc.
bool containsEnum(const Stmt *S)