[cfe-commits] r123363 - in /cfe/trunk: include/clang/StaticAnalyzer/PathSensitive/Checker.h include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h lib/StaticAnalyzer/Checker.cpp lib/StaticAnalyzer/Checkers/ExprEngine.cpp lib/StaticAnalyzer/CoreEngine.cpp
Ted Kremenek
kremenek at apple.com
Wed Jan 12 20:36:46 PST 2011
Author: kremenek
Date: Wed Jan 12 22:36:46 2011
New Revision: 123363
URL: http://llvm.org/viewvc/llvm-project?rev=123363&view=rev
Log:
Rename 'HasGeneratedNode' to 'hasGeneratedNode'
and 'getBasePredecessor()' to 'getPredecessor()'.
Also remove a unneeded save-and-restore of
node builder's tag field.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/Checker.h
cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h
cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h
cfe/trunk/lib/StaticAnalyzer/Checker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/Checker.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/Checker.h?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/Checker.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/Checker.h Wed Jan 12 22:36:46 2011
@@ -50,7 +50,7 @@
OldSink(B.BuildSinks),
checkerTag(tag),
OldPointKind(B.PointKind, K),
- OldHasGen(B.HasGeneratedNode),
+ OldHasGen(B.hasGeneratedNode),
ST(st), statement(stmt), size(Dst.size()),
respondsToCallback(respondsToCB) {}
Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CoreEngine.h Wed Jan 12 22:36:46 2011
@@ -145,7 +145,7 @@
public:
bool PurgingDeadSymbols;
bool BuildSinks;
- bool HasGeneratedNode;
+ bool hasGeneratedNode;
ProgramPoint::Kind PointKind;
const void *Tag;
@@ -163,7 +163,7 @@
~StmtNodeBuilder();
- ExplodedNode* getBasePredecessor() const { return Pred; }
+ ExplodedNode* getPredecessor() const { return Pred; }
// FIXME: This should not be exposed.
WorkList *getWorkList() { return Eng.WList; }
@@ -181,14 +181,14 @@
}
ExplodedNode* generateNode(PostStmt PP,const GRState* St,ExplodedNode* Pred) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
return generateNodeInternal(PP, St, Pred);
}
ExplodedNode* generateNode(const Stmt *S, const GRState *St,
ExplodedNode *Pred, ProgramPoint::Kind K,
const void *tag = 0) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
if (PurgingDeadSymbols)
K = ProgramPoint::PostPurgeDeadSymbolsKind;
@@ -203,7 +203,7 @@
ExplodedNode *generateNode(const ProgramPoint &PP, const GRState* State,
ExplodedNode* Pred) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
return generateNodeInternal(PP, State, Pred);
}
@@ -233,7 +233,7 @@
unsigned getIndex() const { return Idx; }
const GRState* GetState(ExplodedNode* Pred) const {
- if (Pred == getBasePredecessor())
+ if (Pred == getPredecessor())
return CleanedState;
else
return Pred->getState();
@@ -403,7 +403,6 @@
protected:
CoreEngine &engine;
ExplodedNode *pred;
- bool HasGeneratedNode;
ProgramPoint pp;
llvm::SmallVector<ExplodedNode*, 2> sinksGenerated;
@@ -411,10 +410,10 @@
ProgramPoint programPoint, bool asSink);
GenericNodeBuilderImpl(CoreEngine &eng, ExplodedNode *pr, ProgramPoint p)
- : engine(eng), pred(pr), HasGeneratedNode(false), pp(p) {}
+ : engine(eng), pred(pr), pp(p), hasGeneratedNode(false) {}
public:
- bool hasGeneratedNode() const { return HasGeneratedNode; }
+ bool hasGeneratedNode;
WorkList &getWorkList() { return *engine.WList; }
@@ -450,11 +449,11 @@
ExplodedNode* Pred;
public:
- bool HasGeneratedNode;
+ bool hasGeneratedNode;
public:
EndOfFunctionNodeBuilder(const CFGBlock* b, ExplodedNode* N, CoreEngine* e)
- : Eng(*e), B(*b), Pred(N), HasGeneratedNode(false) {}
+ : Eng(*e), B(*b), Pred(N), hasGeneratedNode(false) {}
~EndOfFunctionNodeBuilder();
Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/ExprEngineBuilders.h Wed Jan 12 22:36:46 2011
@@ -31,7 +31,6 @@
const unsigned OldSize;
const bool AutoCreateNode;
SaveAndRestore<bool> OldSink;
- SaveAndRestore<const void*> OldTag;
SaveOr OldHasGen;
private:
@@ -48,14 +47,14 @@
const Stmt* s, bool auto_create_node)
: Dst(dst), B(builder), Eng(eng), Pred(pred),
state(st), stmt(s), OldSize(Dst.size()), AutoCreateNode(auto_create_node),
- OldSink(B.BuildSinks), OldTag(B.Tag), OldHasGen(B.HasGeneratedNode) {}
+ OldSink(B.BuildSinks), OldHasGen(B.hasGeneratedNode) {}
public:
~StmtNodeBuilderRef() {
// Handle the case where no nodes where generated. Auto-generate that
// contains the updated state if we aren't generating sinks.
- if (!B.BuildSinks && Dst.size() == OldSize && !B.HasGeneratedNode) {
+ if (!B.BuildSinks && Dst.size() == OldSize && !B.hasGeneratedNode) {
if (AutoCreateNode)
B.MakeNode(Dst, const_cast<Stmt*>(stmt), Pred, state);
else
Modified: cfe/trunk/lib/StaticAnalyzer/Checker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checker.cpp?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checker.cpp Wed Jan 12 22:36:46 2011
@@ -24,7 +24,7 @@
// without actually generated a new node. We also shouldn't autotransition
// if we are building sinks or we generated a node and decided to not
// add it as a transition.
- if (Dst.size() == size && !B.BuildSinks && !B.HasGeneratedNode) {
+ if (Dst.size() == size && !B.BuildSinks && !B.hasGeneratedNode) {
if (ST && ST != B.GetState(Pred)) {
static int autoTransitionTag = 0;
addTransition(ST, &autoTransitionTag);
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp Wed Jan 12 22:36:46 2011
@@ -541,7 +541,7 @@
"Error evaluating statement");
Builder = &builder;
- EntryNode = builder.getBasePredecessor();
+ EntryNode = builder.getPredecessor();
// Create the cleaned state.
const LocationContext *LC = EntryNode->getLocationContext();
@@ -569,7 +569,7 @@
Tmp.Add(EntryNode);
else {
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
- SaveOr OldHasGen(Builder->HasGeneratedNode);
+ SaveOr OldHasGen(Builder->hasGeneratedNode);
SaveAndRestore<bool> OldPurgeDeadSymbols(Builder->PurgingDeadSymbols);
Builder->PurgingDeadSymbols = true;
@@ -604,7 +604,7 @@
}
}
- if (!Builder->BuildSinks && !Builder->HasGeneratedNode)
+ if (!Builder->BuildSinks && !Builder->hasGeneratedNode)
Tmp.Add(EntryNode);
}
@@ -623,7 +623,7 @@
// a node with a "cleaned" state; CoreEngine will actually handle
// auto-transitions for other cases.
if (Dst.size() == 1 && *Dst.begin() == EntryNode
- && !Builder->HasGeneratedNode && !HasAutoGenerated) {
+ && !Builder->hasGeneratedNode && !HasAutoGenerated) {
HasAutoGenerated = true;
builder.generateNode(currentStmt, GetState(EntryNode), *I);
}
@@ -643,7 +643,7 @@
// We don't set EntryNode and currentStmt. And we don't clean up state.
const CXXCtorInitializer *BMI = Init.getInitializer();
- ExplodedNode *Pred = builder.getBasePredecessor();
+ ExplodedNode *Pred = builder.getPredecessor();
const LocationContext *LC = Pred->getLocationContext();
if (BMI->isAnyMemberInitializer()) {
@@ -699,7 +699,7 @@
void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor dtor,
StmtNodeBuilder &builder) {
- ExplodedNode *pred = builder.getBasePredecessor();
+ ExplodedNode *pred = builder.getPredecessor();
const GRState *state = pred->getState();
const VarDecl *varDecl = dtor.getVarDecl();
@@ -1754,7 +1754,6 @@
SaveAndRestore<ProgramPoint::Kind> OldSPointKind(Builder->PointKind,
ProgramPoint::PostStoreKind);
- SaveAndRestore<const void*> OldTag(Builder->Tag, tag);
// Proceed with the store. We use AssignE as the anchor for the PostStore
// ProgramPoint if it is non-NULL, and LocationE otherwise.
@@ -1811,7 +1810,6 @@
assert(!location.isUndef());
SaveAndRestore<ProgramPoint::Kind> OldSPointKind(Builder->PointKind);
- SaveAndRestore<const void*> OldTag(Builder->Tag);
// Proceed with the load.
for (ExplodedNodeSet::iterator NI=Tmp.begin(), NE=Tmp.end(); NI!=NE; ++NI) {
@@ -1971,7 +1969,7 @@
// Dispatch to the plug-in transfer function.
unsigned oldSize = DstTmp3.size();
- SaveOr OldHasGen(Builder->HasGeneratedNode);
+ SaveOr OldHasGen(Builder->hasGeneratedNode);
Pred = *DI_Checker;
// Dispatch to transfer function logic to handle the call itself.
@@ -1982,7 +1980,7 @@
// Handle the case where no nodes where generated. Auto-generate that
// contains the updated state if we aren't generating sinks.
if (!Builder->BuildSinks && DstTmp3.size() == oldSize &&
- !Builder->HasGeneratedNode)
+ !Builder->hasGeneratedNode)
MakeNode(DstTmp3, CE, Pred, state);
}
}
@@ -2260,7 +2258,7 @@
bool RaisesException = false;
unsigned oldSize = dstEval.size();
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
- SaveOr OldHasGen(Builder->HasGeneratedNode);
+ SaveOr OldHasGen(Builder->hasGeneratedNode);
if (const Expr *Receiver = ME->getInstanceReceiver()) {
const GRState *state = GetState(Pred);
@@ -2344,7 +2342,7 @@
// Handle the case where no nodes where generated. Auto-generate that
// contains the updated state if we aren't generating sinks.
if (!Builder->BuildSinks && dstEval.size() == oldSize &&
- !Builder->HasGeneratedNode)
+ !Builder->hasGeneratedNode)
MakeNode(dstEval, ME, Pred, GetState(Pred));
}
@@ -3082,11 +3080,10 @@
// Record the returned expression in the state. It will be used in
// processCallExit to bind the return value to the call expr.
{
- static int Tag = 0;
- SaveAndRestore<const void *> OldTag(Builder->Tag, &Tag);
+ static int tag = 0;
const GRState *state = GetState(Pred);
state = state->set<ReturnExpr>(RetE);
- Pred = Builder->generateNode(RetE, state, Pred);
+ Pred = Builder->generateNode(RetE, state, Pred, &tag);
}
// We may get a NULL Pred because we generated a cached node.
if (Pred)
@@ -3108,13 +3105,13 @@
unsigned size = Dst.size();
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
- SaveOr OldHasGen(Builder->HasGeneratedNode);
+ SaveOr OldHasGen(Builder->hasGeneratedNode);
getTF().evalReturn(Dst, *this, *Builder, RS, Pred);
// Handle the case where no nodes where generated.
if (!Builder->BuildSinks && Dst.size() == size &&
- !Builder->HasGeneratedNode)
+ !Builder->hasGeneratedNode)
MakeNode(Dst, RS, Pred, GetState(Pred));
}
}
Modified: cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp?rev=123363&r1=123362&r2=123363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/CoreEngine.cpp Wed Jan 12 22:36:46 2011
@@ -295,7 +295,7 @@
SubEng.processCFGBlockEntrance(dstNodes, nodeBuilder);
if (dstNodes.empty()) {
- if (!nodeBuilder.hasGeneratedNode()) {
+ if (!nodeBuilder.hasGeneratedNode) {
// Auto-generate a node and enqueue it to the worklist.
generateNode(BE, Pred->State, Pred);
}
@@ -468,7 +468,7 @@
ProgramPoint programPoint,
bool asSink) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
bool isNew;
ExplodedNode *node = engine.getGraph().getNode(programPoint, state, &isNew);
if (pred)
@@ -487,7 +487,7 @@
ExplodedNode* N, CoreEngine* e,
GRStateManager &mgr)
: Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr),
- PurgingDeadSymbols(false), BuildSinks(false), HasGeneratedNode(false),
+ PurgingDeadSymbols(false), BuildSinks(false), hasGeneratedNode(false),
PointKind(ProgramPoint::PostStmtKind), Tag(0) {
Deferred.insert(N);
CleanedState = Pred->getState();
@@ -706,7 +706,7 @@
EndOfFunctionNodeBuilder::~EndOfFunctionNodeBuilder() {
// Auto-generate an EOP node if one has not been generated.
- if (!HasGeneratedNode) {
+ if (!hasGeneratedNode) {
// If we are in an inlined call, generate CallExit node.
if (Pred->getLocationContext()->getParent())
GenerateCallExitNode(Pred->State);
@@ -718,7 +718,7 @@
ExplodedNode*
EndOfFunctionNodeBuilder::generateNode(const GRState* State, const void *tag,
ExplodedNode* P) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
bool IsNew;
ExplodedNode* Node = Eng.G->getNode(BlockEntrance(&B,
@@ -735,7 +735,7 @@
}
void EndOfFunctionNodeBuilder::GenerateCallExitNode(const GRState *state) {
- HasGeneratedNode = true;
+ hasGeneratedNode = true;
// Create a CallExit node and enqueue it.
const StackFrameContext *LocCtx
= cast<StackFrameContext>(Pred->getLocationContext());
More information about the cfe-commits
mailing list