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_GR_PATHSENSITIVE_CHECKERHELPERS 15 #define LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS 16 17 #include "clang/AST/Stmt.h" 18 19 namespace clang { 20 21 namespace ento { 22 23 bool containsMacro(const Stmt *S); 24 bool containsEnum(const Stmt *S); 25 bool containsStaticLocal(const Stmt *S); 26 bool containsBuiltinOffsetOf(const Stmt *S); containsStmt(const Stmt * S)27template <class T> bool containsStmt(const Stmt *S) { 28 if (isa<T>(S)) 29 return true; 30 31 for (Stmt::const_child_range I = S->children(); I; ++I) 32 if (const Stmt *child = *I) 33 if (containsStmt<T>(child)) 34 return true; 35 36 return false; 37 } 38 39 } // end GR namespace 40 41 } // end clang namespace 42 43 #endif 44