CheckerHelpers.h revision 218893
131567Ssef//== CheckerHelpers.h - Helper functions for checkers ------------*- C++ -*--=// 231899Ssef// 331899Ssef// The LLVM Compiler Infrastructure 431899Ssef// 531899Ssef// This file is distributed under the University of Illinois Open Source 631899Ssef// License. See LICENSE.TXT for details. 731899Ssef// 831899Ssef//===----------------------------------------------------------------------===// 931899Ssef// 1031899Ssef// This file defines CheckerVisitor. 1131899Ssef// 1231899Ssef//===----------------------------------------------------------------------===// 1331899Ssef 1431899Ssef#ifndef LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS 1531899Ssef#define LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS 1631899Ssef 1731899Ssef#include "clang/AST/Stmt.h" 1831899Ssef 1931899Ssefnamespace clang { 2031899Ssef 2131899Ssefnamespace ento { 2231899Ssef 2331899Ssefbool containsMacro(const Stmt *S); 2431899Ssefbool containsEnum(const Stmt *S); 2531899Ssefbool containsStaticLocal(const Stmt *S); 2631899Ssefbool containsBuiltinOffsetOf(const Stmt *S); 2731899Sseftemplate <class T> bool containsStmt(const Stmt *S) { 2831899Ssef if (isa<T>(S)) 2931899Ssef return true; 3031899Ssef 3131899Ssef for (Stmt::const_child_range I = S->children(); I; ++I) 32119852Scharnier if (const Stmt *child = *I) 33119852Scharnier if (containsStmt<T>(child)) 3432275Scharnier return true; 3531899Ssef 3631567Ssef return false; 3731567Ssef} 3831567Ssef 3931567Ssef} // end GR namespace 4031567Ssef 4185301Sdes} // end clang namespace 42123916Scracauer 43104581Smike#endif 44123916Scracauer