1a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//== CheckerHelpers.h - Helper functions for checkers ------------*- C++ -*--=//
2a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//
3a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//                     The LLVM Compiler Infrastructure
4a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//
5a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care// This file is distributed under the University of Illinois Open Source
6a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care// License. See LICENSE.TXT for details.
7a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//
8a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//===----------------------------------------------------------------------===//
9a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//
10a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//  This file defines CheckerVisitor.
11a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//
12a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care//===----------------------------------------------------------------------===//
13a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
145a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis#ifndef LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS
155a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis#define LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS
16a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
17a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care#include "clang/AST/Stmt.h"
18a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
19a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Carenamespace clang {
20a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
219ef6537a894c33003359b1f9b9676e9178e028b7Ted Kremeneknamespace ento {
225a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis
23a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Carebool containsMacro(const Stmt *S);
24a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Carebool containsEnum(const Stmt *S);
25a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Carebool containsStaticLocal(const Stmt *S);
26a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Carebool containsBuiltinOffsetOf(const Stmt *S);
27a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Caretemplate <class T> bool containsStmt(const Stmt *S) {
28a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care  if (isa<T>(S))
29a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care      return true;
30a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
317502c1d3ce8bb97bcc4f7bebef507040bd93b26fJohn McCall  for (Stmt::const_child_range I = S->children(); I; ++I)
32a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care    if (const Stmt *child = *I)
33a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care      if (containsStmt<T>(child))
34a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care        return true;
35a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
36a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care  return false;
37a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care}
38a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
395a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis} // end GR namespace
405a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis
415a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis} // end clang namespace
42a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care
43a9fbf5ba297d77a34d564055f1f05414e0224bf9Tom Care#endif
44