[cfe-commits] r53028 - in /cfe/trunk/Driver: ASTConsumers.cpp ASTConsumers.h AnalysisConsumer.cpp AnalysisConsumer.h clang.cpp
Ted Kremenek
kremenek at apple.com
Wed Jul 2 09:36:06 PDT 2008
Author: kremenek
Date: Wed Jul 2 11:35:50 2008
New Revision: 53028
URL: http://llvm.org/viewvc/llvm-project?rev=53028&view=rev
Log:
Move logic for "-checker-simple" to the new AnalysisConsumer interface.
Modified:
cfe/trunk/Driver/ASTConsumers.cpp
cfe/trunk/Driver/ASTConsumers.h
cfe/trunk/Driver/AnalysisConsumer.cpp
cfe/trunk/Driver/AnalysisConsumer.h
cfe/trunk/Driver/clang.cpp
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=53028&r1=53027&r2=53028&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Wed Jul 2 11:35:50 2008
@@ -733,39 +733,6 @@
}
//===----------------------------------------------------------------------===//
-// GRSimpleVals - Perform intra-procedural, path-sensitive constant propagation.
-
-namespace {
-class GRSimpleValsVisitor : public CheckerConsumer {
-public:
- GRSimpleValsVisitor(Diagnostic &diags, Preprocessor* pp,
- PreprocessorFactory* ppf,
- const std::string& fname, const std::string& htmldir,
- bool visualize, bool trim, bool analyzeAll)
- : CheckerConsumer(diags, pp, ppf, fname, htmldir, visualize,
- trim, analyzeAll) {}
-
- virtual const char* getCheckerName() { return "GRSimpleVals"; }
-
- virtual void getTransferFunctions(std::vector<GRTransferFuncs*>& TFs) {
- return TFs.push_back(MakeGRSimpleValsTF());
- }
-};
-} // end anonymous namespace
-
-ASTConsumer* clang::CreateGRSimpleVals(Diagnostic &Diags,
- Preprocessor* PP,
- PreprocessorFactory* PPF,
- const std::string& FunctionName,
- const std::string& HTMLDir,
- bool Visualize, bool TrimGraph,
- bool AnalyzeAll) {
-
- return new GRSimpleValsVisitor(Diags, PP, PPF, FunctionName, HTMLDir,
- Visualize, TrimGraph, AnalyzeAll);
-}
-
-//===----------------------------------------------------------------------===//
// AST Serializer
namespace {
Modified: cfe/trunk/Driver/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.h?rev=53028&r1=53027&r2=53028&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.h (original)
+++ cfe/trunk/Driver/ASTConsumers.h Wed Jul 2 11:35:50 2008
@@ -40,12 +40,6 @@
ASTConsumer *CreateLiveVarAnalyzer(const std::string& fname);
-ASTConsumer *CreateGRSimpleVals(Diagnostic &Diags,
- Preprocessor* PP, PreprocessorFactory* PPF,
- const std::string& Function,
- const std::string& HTMLDir, bool Visualize,
- bool TrimGraph, bool AnalyzeAll);
-
ASTConsumer *CreateCodeRewriterTest(const std::string& InFile,
const std::string& OutFile,
Diagnostic &Diags,
Modified: cfe/trunk/Driver/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/AnalysisConsumer.cpp?rev=53028&r1=53027&r2=53028&view=diff
==============================================================================
--- cfe/trunk/Driver/AnalysisConsumer.cpp (original)
+++ cfe/trunk/Driver/AnalysisConsumer.cpp Wed Jul 2 11:35:50 2008
@@ -227,24 +227,30 @@
}
-static void ActionRefLeakCheckerAux(AnalysisManager& mgr, bool GCEnabled,
- bool StandardWarnings) {
-
+static void ActionGRExprEngine(AnalysisManager& mgr, GRTransferFuncs* tf) {
+
+ llvm::OwningPtr<GRTransferFuncs> TF(tf);
+
// Construct the analysis engine.
- GRExprEngine Eng(*mgr.getCFG(), *mgr.getCodeDecl(), mgr.getContext());
+ GRExprEngine Eng(*mgr.getCFG(), *mgr.getCodeDecl(), mgr.getContext());
+ Eng.setTransferFunctions(tf);
- // Construct the transfer function object.
- llvm::OwningPtr<GRTransferFuncs>
- TF(MakeCFRefCountTF(mgr.getContext(), GCEnabled, StandardWarnings,
- mgr.getLangOptions()));
-
- Eng.setTransferFunctions(TF.get());
-
// Execute the worklist algorithm.
Eng.ExecuteWorkList();
-
+
// Display warnings.
- Eng.EmitWarnings(mgr.getDiagnostic(), mgr.getPathDiagnosticClient());
+ Eng.EmitWarnings(mgr.getDiagnostic(), mgr.getPathDiagnosticClient());
+}
+
+static void ActionRefLeakCheckerAux(AnalysisManager& mgr, bool GCEnabled,
+ bool StandardWarnings) {
+
+ GRTransferFuncs* TF = MakeCFRefCountTF(mgr.getContext(),
+ GCEnabled,
+ StandardWarnings,
+ mgr.getLangOptions());
+
+ ActionGRExprEngine(mgr, TF);
}
static void ActionRefLeakChecker(AnalysisManager& mgr) {
@@ -267,6 +273,10 @@
}
}
+static void ActionSimpleChecks(AnalysisManager& mgr) {
+ ActionGRExprEngine(mgr, MakeGRSimpleValsTF());
+}
+
//===----------------------------------------------------------------------===//
// AnalysisConsumer creation.
//===----------------------------------------------------------------------===//
@@ -298,6 +308,10 @@
C->addCodeAction(&ActionRefLeakChecker);
break;
+ case CheckerSimple:
+ C->addCodeAction(&ActionSimpleChecks);
+ break;
+
default: break;
}
Modified: cfe/trunk/Driver/AnalysisConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/AnalysisConsumer.h?rev=53028&r1=53027&r2=53028&view=diff
==============================================================================
--- cfe/trunk/Driver/AnalysisConsumer.h (original)
+++ cfe/trunk/Driver/AnalysisConsumer.h Wed Jul 2 11:35:50 2008
@@ -19,7 +19,8 @@
enum Analyses {
WarnDeadStores,
WarnUninitVals,
- CheckerCFRef
+ CheckerCFRef,
+ CheckerSimple
};
ASTConsumer* CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=53028&r1=53027&r2=53028&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Wed Jul 2 11:35:50 2008
@@ -75,8 +75,6 @@
ParseCFGDump, // Parse ASTS. Build CFGs. Print CFGs.
ParseCFGView, // Parse ASTS. Build CFGs. View CFGs.
AnalysisLiveVariables, // Print results of live-variable analysis.
- AnalysisGRSimpleVals, // Perform graph-reachability constant prop.
- AnalysisGRSimpleValsView, // Visualize results of path-sens. analysis.
TestSerialization, // Run experimental serialization code.
ParsePrintCallbacks, // Parse and print each callback.
ParseSyntaxOnly, // Parse and perform semantic analysis.
@@ -117,8 +115,6 @@
"Run parser, then build and view CFGs with Graphviz"),
clEnumValN(AnalysisLiveVariables, "dump-live-variables",
"Print results of live variable analysis"),
- clEnumValN(AnalysisGRSimpleVals, "checker-simple",
- "Perform path-sensitive constant propagation"),
clEnumValN(TestSerialization, "test-pickling",
"Run prototype serialization code"),
clEnumValN(EmitLLVM, "emit-llvm",
@@ -179,8 +175,10 @@
"Flag warnings of stores to dead variables"),
clEnumValN(WarnUninitVals, "warn-uninit-values",
"Flag warnings of uses of unitialized variables"),
+clEnumValN(CheckerSimple, "checker-simple",
+ "Perform simple path-sensitive checks."),
clEnumValN(CheckerCFRef, "checker-cfref",
- "Run the [Core] Foundation reference count checker"),
+ "Run the [Core] Foundation reference count checker"),
clEnumValEnd));
//===----------------------------------------------------------------------===//
@@ -1200,11 +1198,7 @@
case AnalysisLiveVariables:
return CreateLiveVarAnalyzer(AnalyzeSpecificFunction);
-
- case AnalysisGRSimpleVals:
- return CreateGRSimpleVals(Diag, PP, PPF, AnalyzeSpecificFunction,
- OutputFile, VisualizeEG, TrimGraph, AnalyzeAll);
-
+
case TestSerialization:
return CreateSerializationTest(Diag, FileMgr);
More information about the cfe-commits
mailing list