1 //== CheckerHelpers.h - Helper functions for checkers ------------*- 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 //  This file defines CheckerVisitor.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
16 
17 #include "clang/AST/Stmt.h"
18 #include <tuple>
19 
20 namespace clang {
21 
22 class Expr;
23 class VarDecl;
24 
25 namespace ento {
26 
27 bool containsMacro(const Stmt *S);
28 bool containsEnum(const Stmt *S);
29 bool containsStaticLocal(const Stmt *S);
30 bool containsBuiltinOffsetOf(const Stmt *S);
containsStmt(const Stmt * S)31 template <class T> bool containsStmt(const Stmt *S) {
32   if (isa<T>(S))
33       return true;
34 
35   for (const Stmt *Child : S->children())
36     if (Child && containsStmt<T>(Child))
37       return true;
38 
39   return false;
40 }
41 
42 std::pair<const clang::VarDecl *, const clang::Expr *>
43 parseAssignment(const Stmt *S);
44 
45 } // end GR namespace
46 
47 } // end clang namespace
48 
49 #endif
50