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 | 7deed0c65b315cac037539401c49586283158d9f (patch) | |
tree | 196e9e9e291fe158368d13818ac84f80714996bf /lib/Analysis/UninitializedValues.cpp | |
parent | afe10913bddfe0e7beea9a9886ecd1d4aaabd2e6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/UninitializedValues.cpp')
-rw-r--r-- | lib/Analysis/UninitializedValues.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index d5c697aa1c..2116e505d5 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/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 { |