From ab422d17dce198f2af9851340ea7384771a2a8c5 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 8 May 2009 23:08:34 +0000 Subject: [PATCH] Make BlockEntrace program points taggable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71280 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/PathSensitive/GRCoreEngine.h | 12 +++++++++--- include/clang/Analysis/ProgramPoint.h | 3 ++- lib/Analysis/GRCoreEngine.cpp | 13 +++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h index 93c2884f8b..6a32a22a04 100644 --- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h +++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h @@ -539,7 +539,9 @@ public: return getBlockCounter().getNumVisited(B.getBlockID()); } - ExplodedNodeImpl* generateNodeImpl(const void* State); + ExplodedNodeImpl* generateNodeImpl(const void* State, + const void *tag = 0, + ExplodedNodeImpl *P = 0); CFGBlock* getBlock() const { return &B; } }; @@ -571,9 +573,13 @@ public: return getPredecessor()->getState(); } - NodeTy* MakeNode(const StateTy* St) { - return static_cast(NB.generateNodeImpl(St)); + NodeTy* MakeNode(const StateTy* St, const void *tag = 0) { + return static_cast(NB.generateNodeImpl(St, tag)); } + + NodeTy *generateNode(const StateTy *St, NodeTy *Pred, const void *tag = 0) { + return static_cast(NB.generateNodeImpl(St, tag, Pred)); + } }; diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index 074a262038..8e6d5ec831 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -131,7 +131,8 @@ public: class BlockEntrance : public ProgramPoint { public: - BlockEntrance(const CFGBlock* B) : ProgramPoint(B, BlockEntranceKind) {} + BlockEntrance(const CFGBlock* B, const void *tag = 0) + : ProgramPoint(B, BlockEntranceKind, tag) {} CFGBlock* getBlock() const { return reinterpret_cast(getData1NoMask()); diff --git a/lib/Analysis/GRCoreEngine.cpp b/lib/Analysis/GRCoreEngine.cpp index 8bbf71e90a..c75fd9ace1 100644 --- a/lib/Analysis/GRCoreEngine.cpp +++ b/lib/Analysis/GRCoreEngine.cpp @@ -555,16 +555,17 @@ GREndPathNodeBuilderImpl::~GREndPathNodeBuilderImpl() { if (!HasGeneratedNode) generateNodeImpl(Pred->State); } -ExplodedNodeImpl* GREndPathNodeBuilderImpl::generateNodeImpl(const void* State){ - HasGeneratedNode = true; - +ExplodedNodeImpl* +GREndPathNodeBuilderImpl::generateNodeImpl(const void* State, + const void *tag, + ExplodedNodeImpl* P) { + HasGeneratedNode = true; bool IsNew; ExplodedNodeImpl* Node = - Eng.G->getNodeImpl(BlockEntrance(&B), State, &IsNew); + Eng.G->getNodeImpl(BlockEntrance(&B, tag), State, &IsNew); - - Node->addPredecessor(Pred); + Node->addPredecessor(P ? P : Pred); if (IsNew) { Node->markAsSink(); -- 2.40.0