summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-10 22:16:52 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-10 22:16:52 +0000
commit4a78c3ae11c4e3002bbed268b4e62d19e53f4df5 (patch)
treea35cfcc7a6b92ec26908ef2b564ab14d96e89f6e /clang/lib
parent53336d80557b81c54793085280c026dd218f0c75 (diff)
downloadbcm5719-llvm-4a78c3ae11c4e3002bbed268b4e62d19e53f4df5.tar.gz
bcm5719-llvm-4a78c3ae11c4e3002bbed268b4e62d19e53f4df5.zip
Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver. Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref. llvm-svn: 49500
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp19
-rw-r--r--clang/lib/Analysis/GRSimpleVals.cpp31
2 files changed, 5 insertions, 45 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index efd48218e43..85c8e865005 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -874,22 +874,7 @@ void BadRelease::EmitWarnings(BugReporter& BR) {
}
//===----------------------------------------------------------------------===//
-// Driver for the CFRefCount Checker.
+// Transfer function creation for external clients.
//===----------------------------------------------------------------------===//
-namespace clang {
-
-void CheckCFRefCount(CFG& cfg, Decl& CD, ASTContext& Ctx,
- Diagnostic& Diag, PathDiagnosticClient* PD) {
-
- if (Diag.hasErrorOccurred())
- return;
-
- GRExprEngine Eng(cfg, CD, Ctx);
- CFRefCount TF;
- Eng.setTransferFunctions(TF);
- Eng.ExecuteWorkList();
- Eng.EmitWarnings(Diag, PD);
-}
-
-} // end clang namespace
+GRTransferFuncs* clang::MakeCFRefCountTF() { return new CFRefCount(); }
diff --git a/clang/lib/Analysis/GRSimpleVals.cpp b/clang/lib/Analysis/GRSimpleVals.cpp
index 960476dff02..c350ab9752a 100644
--- a/clang/lib/Analysis/GRSimpleVals.cpp
+++ b/clang/lib/Analysis/GRSimpleVals.cpp
@@ -19,6 +19,7 @@
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Analysis/PathSensitive/ValueState.h"
#include "clang/Analysis/PathSensitive/BugReporter.h"
+#include "clang/Analysis/LocalCheckers.h"
#include "llvm/Support/Compiler.h"
#include <sstream>
@@ -310,36 +311,10 @@ void GRSimpleVals::RegisterChecks(GRExprEngine& Eng) {
}
//===----------------------------------------------------------------------===//
-// Analysis Driver.
+// Transfer Function creation for External clients.
//===----------------------------------------------------------------------===//
-namespace clang {
-
-unsigned RunGRSimpleVals(CFG& cfg, Decl& CD, ASTContext& Ctx,
- Diagnostic& Diag, PathDiagnosticClient* PD,
- bool Visualize, bool TrimGraph) {
-
- // Construct the analysis engine.
- GRExprEngine Eng(cfg, CD, Ctx);
-
- // Set base transfer functions.
- GRSimpleVals GRSV;
- Eng.setTransferFunctions(GRSV);
-
- // Execute the worklist algorithm.
- Eng.ExecuteWorkList();
-
- // Display warnings.
- Eng.EmitWarnings(Diag, PD);
-
-#ifndef NDEBUG
- if (Visualize) Eng.ViewGraph(TrimGraph);
-#endif
-
- return Eng.getGraph().size();
-}
-
-} // end clang namespace
+GRTransferFuncs* clang::MakeGRSimpleValsTF() { return new GRSimpleVals(); }
//===----------------------------------------------------------------------===//
// Transfer function for Casts.
OpenPOWER on IntegriCloud