[cfe-commits] r71169 - in /cfe/trunk: include/clang/Analysis/ProgramPoint.h lib/Analysis/GRCoreEngine.cpp lib/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Thu May 7 11:27:17 PDT 2009
Author: kremenek
Date: Thu May 7 13:27:16 2009
New Revision: 71169
URL: http://llvm.org/viewvc/llvm-project?rev=71169&view=rev
Log:
analyzer: Add ProgramPoint 'PostLValue' just to distinguish (for
analysis introspection) when we computed an lvalue. This shouldn't
effect the current analysis results in any way.
Modified:
cfe/trunk/include/clang/Analysis/ProgramPoint.h
cfe/trunk/lib/Analysis/GRCoreEngine.cpp
cfe/trunk/lib/Analysis/GRExprEngine.cpp
Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=71169&r1=71168&r2=71169&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Thu May 7 13:27:16 2009
@@ -39,8 +39,9 @@
PostStoreKind = 0x9,
PostPurgeDeadSymbolsKind = 0x10,
PostStmtCustomKind = 0x11,
+ PostLValueKind = 0x12,
MinPostStmtKind = PostStmtKind,
- MaxPostStmtKind = PostStmtCustomKind };
+ MaxPostStmtKind = PostLValueKind };
private:
enum { TwoPointers = 0x1, Custom = 0x2, Mask = 0x3 };
@@ -269,6 +270,16 @@
return Location->getKind() == PostStoreKind;
}
};
+
+class PostLValue : public PostStmt {
+public:
+ PostLValue(const Stmt* S, const void *tag = 0)
+ : PostStmt(S, PostLValueKind, tag) {}
+
+ static bool classof(const ProgramPoint* Location) {
+ return Location->getKind() == PostLValueKind;
+ }
+};
class PostPurgeDeadSymbols : public PostStmt {
public:
Modified: cfe/trunk/lib/Analysis/GRCoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRCoreEngine.cpp?rev=71169&r1=71168&r2=71169&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRCoreEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRCoreEngine.cpp Thu May 7 13:27:16 2009
@@ -417,6 +417,9 @@
case ProgramPoint::PostStoreKind:
return PostStore(S, tag);
+ case ProgramPoint::PostLValueKind:
+ return PostLValue(S, tag);
+
case ProgramPoint::PostPurgeDeadSymbolsKind:
return PostPurgeDeadSymbols(S, tag);
}
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=71169&r1=71168&r2=71169&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Thu May 7 13:27:16 2009
@@ -963,7 +963,8 @@
SVal V = StateMgr.GetLValue(state, VD);
if (asLValue)
- MakeNode(Dst, Ex, Pred, BindExpr(state, Ex, V));
+ MakeNode(Dst, Ex, Pred, BindExpr(state, Ex, V),
+ ProgramPoint::PostLValueKind);
else
EvalLoad(Dst, Ex, Pred, state, V);
return;
@@ -979,7 +980,8 @@
} else if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) {
assert(asLValue);
SVal V = ValMgr.getFunctionPointer(FD);
- MakeNode(Dst, Ex, Pred, BindExpr(state, Ex, V));
+ MakeNode(Dst, Ex, Pred, BindExpr(state, Ex, V),
+ ProgramPoint::PostLValueKind);
return;
}
@@ -1016,7 +1018,8 @@
GetSVal(state, Idx));
if (asLValue)
- MakeNode(Dst, A, *I2, BindExpr(state, A, V));
+ MakeNode(Dst, A, *I2, BindExpr(state, A, V),
+ ProgramPoint::PostLValueKind);
else
EvalLoad(Dst, A, *I2, state, V);
}
@@ -1047,7 +1050,8 @@
SVal L = StateMgr.GetLValue(state, GetSVal(state, Base), Field);
if (asLValue)
- MakeNode(Dst, M, *I, BindExpr(state, M, L));
+ MakeNode(Dst, M, *I, BindExpr(state, M, L),
+ ProgramPoint::PostLValueKind);
else
EvalLoad(Dst, M, *I, state, L);
}
@@ -2464,7 +2468,8 @@
SVal location = GetSVal(state, Ex);
if (asLValue)
- MakeNode(Dst, U, *I, BindExpr(state, U, location));
+ MakeNode(Dst, U, *I, BindExpr(state, U, location),
+ ProgramPoint::PostLValueKind);
else
EvalLoad(Dst, U, *I, state, location);
}
@@ -3241,6 +3246,17 @@
<< "\\l";
}
+ if (isa<PostLoad>(Loc))
+ Out << "\\lPostLoad\\l;";
+ else if (isa<PostStore>(Loc))
+ Out << "\\lPostStore\\l";
+ else if (isa<PostLValue>(Loc))
+ Out << "\\lPostLValue\\l";
+ else if (isa<PostLocationChecksSucceed>(Loc))
+ Out << "\\lPostLocationChecksSucceed\\l";
+ else if (isa<PostNullCheckFailed>(Loc))
+ Out << "\\lPostNullCheckFailed\\l";
+
if (GraphPrintCheckerState->isImplicitNullDeref(N))
Out << "\\|Implicit-Null Dereference.\\l";
else if (GraphPrintCheckerState->isExplicitNullDeref(N))
More information about the cfe-commits
mailing list