clang API Documentation

CheckerHelpers.h
Go to the documentation of this file.
00001 //== CheckerHelpers.h - Helper functions for checkers ------------*- C++ -*--=//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines CheckerVisitor.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
00015 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
00016 
00017 #include "clang/AST/Stmt.h"
00018 
00019 namespace clang {
00020 
00021 namespace ento {
00022 
00023 bool containsMacro(const Stmt *S);
00024 bool containsEnum(const Stmt *S);
00025 bool containsStaticLocal(const Stmt *S);
00026 bool containsBuiltinOffsetOf(const Stmt *S);
00027 template <class T> bool containsStmt(const Stmt *S) {
00028   if (isa<T>(S))
00029       return true;
00030 
00031   for (Stmt::const_child_range I = S->children(); I; ++I)
00032     if (const Stmt *child = *I)
00033       if (containsStmt<T>(child))
00034         return true;
00035 
00036   return false;
00037 }
00038 
00039 } // end GR namespace
00040 
00041 } // end clang namespace
00042 
00043 #endif