aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h47
1 files changed, 28 insertions, 19 deletions
diff --git a/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 2aca2c99ef4f..8dbe767cef9d 100644
--- a/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -25,6 +25,7 @@
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/WorkList.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Casting.h"
#include <cassert>
#include <memory>
@@ -78,6 +79,7 @@ private:
/// worklist algorithm. It is up to the implementation of WList to decide
/// the order that nodes are processed.
std::unique_ptr<WorkList> WList;
+ std::unique_ptr<WorkList> CTUWList;
/// BCounterFactory - A factory object for created BlockCounter objects.
/// These are used to record for key nodes in the ExplodedGraph the
@@ -96,9 +98,12 @@ private:
/// (This data is owned by AnalysisConsumer.)
FunctionSummariesTy *FunctionSummaries;
- /// Add path note tags along the path when we see that something interesting
- /// is happening. This field is the allocator for such tags.
- NoteTag::Factory NoteTags;
+ /// Add path tags with some useful data along the path when we see that
+ /// something interesting is happening. This field is the allocator for such
+ /// tags.
+ DataTag::Factory DataTags;
+
+ void setBlockCounter(BlockCounter C);
void generateNode(const ProgramPoint &Loc,
ProgramStateRef State,
@@ -169,22 +174,13 @@ public:
}
WorkList *getWorkList() const { return WList.get(); }
+ WorkList *getCTUWorkList() const { return CTUWList.get(); }
- BlocksExhausted::const_iterator blocks_exhausted_begin() const {
- return blocksExhausted.begin();
+ auto exhausted_blocks() const {
+ return llvm::iterator_range(blocksExhausted);
}
- BlocksExhausted::const_iterator blocks_exhausted_end() const {
- return blocksExhausted.end();
- }
-
- BlocksAborted::const_iterator blocks_aborted_begin() const {
- return blocksAborted.begin();
- }
-
- BlocksAborted::const_iterator blocks_aborted_end() const {
- return blocksAborted.end();
- }
+ auto aborted_blocks() const { return llvm::iterator_range(blocksAborted); }
/// Enqueue the given set of nodes onto the work list.
void enqueue(ExplodedNodeSet &Set);
@@ -200,7 +196,7 @@ public:
/// Enqueue a single node created as a result of statement processing.
void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx);
- NoteTag::Factory &getNoteTags() { return NoteTags; }
+ DataTag::Factory &getDataTags() { return DataTags; }
};
// TODO: Turn into a class.
@@ -209,8 +205,14 @@ struct NodeBuilderContext {
const CFGBlock *Block;
const LocationContext *LC;
+ NodeBuilderContext(const CoreEngine &E, const CFGBlock *B,
+ const LocationContext *L)
+ : Eng(E), Block(B), LC(L) {
+ assert(B);
+ }
+
NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N)
- : Eng(E), Block(B), LC(N->getLocationContext()) { assert(B); }
+ : NodeBuilderContext(E, B, N->getLocationContext()) {}
/// Return the CFGBlock associated with this builder.
const CFGBlock *getBlock() const { return Block; }
@@ -289,7 +291,9 @@ public:
ExplodedNode *generateNode(const ProgramPoint &PP,
ProgramStateRef State,
ExplodedNode *Pred) {
- return generateNodeImpl(PP, State, Pred, false);
+ return generateNodeImpl(
+ PP, State, Pred,
+ /*MarkAsSink=*/State->isPosteriorlyOverconstrained());
}
/// Generates a sink in the ExplodedGraph.
@@ -494,6 +498,11 @@ public:
iterator(CFGBlock::const_succ_iterator i) : I(i) {}
public:
+ // This isn't really a conventional iterator.
+ // We just implement the deref as a no-op for now to make range-based for
+ // loops work.
+ const iterator &operator*() const { return *this; }
+
iterator &operator++() { ++I; return *this; }
bool operator!=(const iterator &X) const { return I != X.I; }