1 //== CheckerHelpers.h - Helper functions for checkers ------------*- C++ -*--=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines CheckerVisitor.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
17 #include "clang/AST/Stmt.h"
29 bool containsMacro(const Stmt *S);
30 bool containsEnum(const Stmt *S);
31 bool containsStaticLocal(const Stmt *S);
32 bool containsBuiltinOffsetOf(const Stmt *S);
33 template <class T> bool containsStmt(const Stmt *S) {
37 for (const Stmt *Child : S->children())
38 if (Child && containsStmt<T>(Child))
44 std::pair<const clang::VarDecl *, const clang::Expr *>
45 parseAssignment(const Stmt *S);
47 // Do not reorder! The getMostNullable method relies on the order.
48 // Optimization: Most pointers expected to be unspecified. When a symbol has an
49 // unspecified or nonnull type non of the rules would indicate any problem for
50 // that symbol. For this reason only nullable and contradicted nullability are
51 // stored for a symbol. When a symbol is already contradicted, it can not be
52 // casted back to nullable.
53 enum class Nullability : char {
54 Contradicted, // Tracked nullability is contradicted by an explicit cast. Do
55 // not report any nullability related issue for this symbol.
56 // This nullability is propagated aggressively to avoid false
57 // positive results. See the comment on getMostNullable method.
63 /// Get nullability annotation for a given type.
64 Nullability getNullabilityAnnotation(QualType Type);
68 } // end clang namespace