clang: lib/Analysis/FlowSensitive/Models/ChromiumCheckModel.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
12#include "llvm/ADT/DenseSet.h"
13
16
17
18
19static bool
22
23
25 return false;
26
27 if (CheckDecls.empty()) {
28
29
32 ParentClass->getName() != "CheckError")
33 return false;
34
35
36 const auto *N =
37 dyn_cast_or_null(ParentClass->getDeclContext());
38 if (N == nullptr || !N->getDeclName().isIdentifier() ||
39 N->getName() != "logging")
40 return false;
41
42
43 if (N->getParent() == nullptr || !N->getParent()->isTranslationUnit())
44 return false;
45
47 if (M->getDeclName().isIdentifier() && M->getName().ends_with("Check"))
48 CheckDecls.insert(M);
49 }
50
51 return CheckDecls.contains(&D);
52}
53
56 if (!CS)
57 return false;
58 auto Stmt = CS->getStmt();
59 if (const auto *Call = dyn_cast(Stmt)) {
60 if (const auto *M =
61 dyn_cast_or_null(Call->getDirectCallee())) {
63
65 return true;
66 }
67 }
68 }
69 return false;
70}
71
72}
73}
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Represents a top-level expression in a basic block.
std::optional< T > getAs() const
Convert to the specified CFGElement type, returning std::nullopt if this CFGElement is not of the des...
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a C++ struct/union/class.
method_range methods() const
DeclContext * getDeclContext()
bool isIdentifier() const
Predicate functions for querying what type of name this is.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Stmt - This represents one statement.
const Formula & makeLiteral(bool Value)
Returns a formula for a literal true/false.
bool transfer(const CFGElement &Element, Environment &Env) override
Return value indicates whether the model processed the Element.
Definition ChromiumCheckModel.cpp:54
Holds the state of the program (store and heap) at a given program point.
void assume(const Formula &)
Record a fact that must be true if this point in the program is reached.
Dataflow Directional Tag Classes.
static bool isCheckLikeMethod(llvm::SmallDenseSet< const CXXMethodDecl * > &CheckDecls, const CXXMethodDecl &D)
Determines whether D is one of the methods used to implement Chromium's CHECK macros.
Definition ChromiumCheckModel.cpp:20
The JSON file list parser is used to communicate input to InstallAPI.