From b6a2b08a6b3fbce1a6a4b69d4185165de970696c Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 11 Jan 2011 16:53:44 +0000 Subject: [PATCH] Remove ProgramPoint parameter from GenericNodeBuilder::generateNode(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123240 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/ProgramPoint.h | 6 ++++++ .../clang/StaticAnalyzer/PathSensitive/CoreEngine.h | 11 ++++++----- lib/StaticAnalyzer/Checkers/ExprEngine.cpp | 4 +--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index 36e40164c0..9656803b63 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -119,6 +119,12 @@ public: return B->empty() ? CFGElement() : B->front(); } + /// Create a new BlockEntrance object that is the same as the original + /// except for using the specified tag value. + BlockEntrance withTag(const void *tag) { + return BlockEntrance(getBlock(), getLocationContext(), tag); + } + static bool classof(const ProgramPoint* Location) { return Location->getKind() == BlockEntranceKind; } diff --git a/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h index 44a321c2f7..bc920d5cb1 100644 --- a/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h +++ b/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h @@ -428,18 +428,19 @@ public: } }; -template +template class GenericNodeBuilder : public GenericNodeBuilderImpl { public: - GenericNodeBuilder(CoreEngine &eng, ExplodedNode *pr, const PP &p) + GenericNodeBuilder(CoreEngine &eng, ExplodedNode *pr, const PP_T &p) : GenericNodeBuilderImpl(eng, pr, p) {} ExplodedNode *generateNode(const GRState *state, ExplodedNode *pred, - PP programPoint, bool asSink) { - return generateNodeImpl(state, pred, programPoint, asSink); + const void *tag, bool asSink) { + return generateNodeImpl(state, pred, cast(pp).withTag(tag), + asSink); } - const PP &getProgramPoint() const { return cast(pp); } + const PP_T &getProgramPoint() const { return cast(pp); } }; class EndOfFunctionNodeBuilder { diff --git a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp index e6d9d715d4..3f9eb1b451 100644 --- a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp @@ -1089,9 +1089,7 @@ void ExprEngine::processCFGBlockEntrance(ExplodedNodeSet &dstNodes, block->getBlockID()) >= AMgr.getMaxVisit()) { static int tag = 0; - const BlockEntrance &BE = nodeBuilder.getProgramPoint(); - BlockEntrance BE_tagged(BE.getBlock(), BE.getLocationContext(), &tag); - nodeBuilder.generateNode(pred->getState(), pred, BE_tagged, true); + nodeBuilder.generateNode(pred->getState(), pred, &tag, true); } } -- 2.40.0