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 20namespace clang { 21 22class Expr; 23class VarDecl; 24 25namespace ento { 26 27bool containsMacro(const Stmt *S); 28bool containsEnum(const Stmt *S); 29bool containsStaticLocal(const Stmt *S); 30bool containsBuiltinOffsetOf(const Stmt *S); 31template <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 42std::pair<const clang::VarDecl *, const clang::Expr *> 43parseAssignment(const Stmt *S); 44 45} // end GR namespace 46 47} // end clang namespace 48 49#endif 50