diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-04-15 18:35:30 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-04-15 18:35:30 +0000 |
| commit | 82ff6d65bc34ea18b0916aa4a810c9b27d3335b4 (patch) | |
| tree | 7b198beb1896aad1510f7561bd2b2d40343ea98d /clang/lib/Analysis/UninitializedValues.cpp | |
| parent | 8fc8a272e0caf21930a73b3df33f4a75bc38e34b (diff) | |
| download | bcm5719-llvm-82ff6d65bc34ea18b0916aa4a810c9b27d3335b4.tar.gz bcm5719-llvm-82ff6d65bc34ea18b0916aa4a810c9b27d3335b4.zip | |
Fix bug in terminator processing for uninitialized-values: simply ignore the terminator, don't reprocess it.
LiveVariables analysis now does a flow-insensitive analysis to determine what variables have their address taken; these variables are now always treated as being live.
The DataflowSolver now uses "SetTopValue()" when getting the initial value for the entry/exit block.
llvm-svn: 49734
Diffstat (limited to 'clang/lib/Analysis/UninitializedValues.cpp')
| -rw-r--r-- | clang/lib/Analysis/UninitializedValues.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index d5c697aa1c8..2116e505d51 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -58,13 +58,15 @@ class VISIBILITY_HIDDEN TransferFuncs UninitializedValues::ValTy V; UninitializedValues::AnalysisDataTy& AD; public: - TransferFuncs(UninitializedValues::AnalysisDataTy& ad) : AD(ad) { - V.resetValues(AD); - } + TransferFuncs(UninitializedValues::AnalysisDataTy& ad) : AD(ad) {} UninitializedValues::ValTy& getVal() { return V; } CFG& getCFG() { return AD.getCFG(); } + void SetTopValue(UninitializedValues::ValTy& X) { + X.resetValues(AD); + } + bool VisitDeclRefExpr(DeclRefExpr* DR); bool VisitBinaryOperator(BinaryOperator* B); bool VisitUnaryOperator(UnaryOperator* U); @@ -76,7 +78,7 @@ public: bool Visit(Stmt *S); bool BlockStmt_VisitExpr(Expr* E); - void VisitTerminator(Stmt* T) { Visit(T); } + void VisitTerminator(Stmt* T) { } BlockVarDecl* FindBlockVarDecl(Stmt* S); }; @@ -216,12 +218,9 @@ bool TransferFuncs::BlockStmt_VisitExpr(Expr* E) { // In our transfer functions we take the approach that any // combination of unintialized values, e.g. Unitialized + ___ = Unitialized. // -// Merges take the opposite approach. -// -// In the merge of dataflow values we prefer unsoundness, and -// prefer false negatives to false positives. At merges, if a value for a -// tracked Decl is EVER initialized in any of the predecessors we treat it as -// initialized at the confluence point. +// Merges take the same approach, preferring soundness. At a confluence point, +// if any predecessor has a variable marked uninitialized, the value is +// uninitialized at the confluence point. //===----------------------------------------------------------------------===// namespace { |

