[cfe-commits] r42107 - in /cfe/trunk/Analysis: DataflowSolver.h UninitializedValues.cpp
Ted Kremenek
kremenek at apple.com
Tue Sep 18 14:08:21 PDT 2007
Author: kremenek
Date: Tue Sep 18 16:08:21 2007
New Revision: 42107
URL: http://llvm.org/viewvc/llvm-project?rev=42107&view=rev
Log:
Add overloaded versions of DataflowSolver::runOnBlock to simplify
invocation of the solver.
UninitializedValues checker now uses CFG::runOnAllBlocks to query the
computed dataflow values (tighter code).
Modified:
cfe/trunk/Analysis/DataflowSolver.h
cfe/trunk/Analysis/UninitializedValues.cpp
Modified: cfe/trunk/Analysis/DataflowSolver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/DataflowSolver.h?rev=42107&r1=42106&r2=42107&view=diff
==============================================================================
--- cfe/trunk/Analysis/DataflowSolver.h (original)
+++ cfe/trunk/Analysis/DataflowSolver.h Tue Sep 18 16:08:21 2007
@@ -90,6 +90,15 @@
ProcessBlock(B,AnalysisDirTag());
}
+ void runOnBlock(const CFGBlock& B) { runOnBlock(&B); }
+ void runOnBlock(CFG::iterator &I) { runOnBlock(*I); }
+ void runOnBlock(CFG::const_iterator &I) { runOnBlock(*I); }
+
+ void runOnAllBlocks(const CFG& cfg) {
+ for (CFG::const_iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I)
+ runOnBlock(I);
+ }
+
//===--------------------------------------------------------------------===//
// Internal solver logic.
//===--------------------------------------------------------------------===//
Modified: cfe/trunk/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/UninitializedValues.cpp?rev=42107&r1=42106&r2=42107&view=diff
==============================================================================
--- cfe/trunk/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/Analysis/UninitializedValues.cpp Tue Sep 18 16:08:21 2007
@@ -238,7 +238,6 @@
Dst.DeclBV |= Src.DeclBV;
Dst.ExprBV |= Src.ExprBV;
-
}
};
} // end anonymous namespace
@@ -250,7 +249,6 @@
UninitializedValues_ValueTypes::ObserverTy::~ObserverTy() {}
namespace {
-
class UninitializedValuesChecker : public UninitializedValues::ObserverTy {
ASTContext &Ctx;
Diagnostic &Diags;
@@ -270,11 +268,9 @@
Diags.Report(DR->getSourceRange().Begin(), diag::warn_uninit_val);
}
};
-
} // end anonymous namespace
namespace clang {
-
void CheckUninitializedValues(CFG& cfg, ASTContext &Ctx, Diagnostic &Diags) {
typedef DataflowSolver<UninitializedValues,TransferFuncs,Merge> Solver;
@@ -287,9 +283,6 @@
// Scan for DeclRefExprs that use uninitialized values.
UninitializedValuesChecker Observer(Ctx,Diags);
U.getAnalysisData().Observer = &Observer;
-
- for (CFG::iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I)
- S.runOnBlock(&*I);
-}
-
+ S.runOnAllBlocks(cfg);
}
+} // end namespace clang
More information about the cfe-commits
mailing list