aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/AnalysisConsumer.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-12-23 08:56:18 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-12-23 08:56:18 +0000
commit3ff8481f4be3f30e1082488238d83f78342303e1 (patch)
tree4b0393b521b0d395502274983a02c5538d9a8d9b /lib/Frontend/AnalysisConsumer.cpp
parente7809d49413febf078d0503753987fe9f6061a68 (diff)
Migrate the call inliner to the Checker interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/AnalysisConsumer.cpp')
-rw-r--r--lib/Frontend/AnalysisConsumer.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp
index 9fade9488b..ec55c4ca0e 100644
--- a/lib/Frontend/AnalysisConsumer.cpp
+++ b/lib/Frontend/AnalysisConsumer.cpp
@@ -254,7 +254,7 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
if (!TranslationUnitActions.empty()) {
// Find the entry function definition (if any).
FunctionDecl *FD = 0;
-
+ // Must specify an entry function.
if (!Opts.AnalyzeSpecificFunction.empty()) {
for (DeclContext::decl_iterator I=TU->decls_begin(), E=TU->decls_end();
I != E; ++I) {
@@ -267,9 +267,11 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
}
}
- for (Actions::iterator I = TranslationUnitActions.begin(),
- E = TranslationUnitActions.end(); I != E; ++I)
- (*I)(*this, *Mgr, FD);
+ if (FD) {
+ for (Actions::iterator I = TranslationUnitActions.begin(),
+ E = TranslationUnitActions.end(); I != E; ++I)
+ (*I)(*this, *Mgr, FD);
+ }
}
if (!ObjCImplementationActions.empty()) {
@@ -489,8 +491,35 @@ static void ActionWarnSizeofPointer(AnalysisConsumer &C, AnalysisManager &mgr,
static void ActionInlineCall(AnalysisConsumer &C, AnalysisManager &mgr,
Decl *D) {
+ // FIXME: This is largely copy of ActionGRExprEngine. Needs cleanup.
+ // Display progress.
+ C.DisplayFunction(D);
+
+ GRExprEngine Eng(mgr);
+
+ RegisterCallInliner(Eng);
+
+ if (C.Opts.EnableExperimentalInternalChecks)
+ RegisterExperimentalInternalChecks(Eng);
+
+ RegisterAppleChecks(Eng, *D);
+
+ if (C.Opts.EnableExperimentalChecks)
+ RegisterExperimentalChecks(Eng);
- ActionGRExprEngine(C, mgr, D, CreateCallInliner(mgr.getASTContext()));
+ // Make a fake transfer function. The GRTransferFunc interface will be
+ // removed.
+ Eng.setTransferFunctions(new GRTransferFuncs());
+
+ // Execute the worklist algorithm.
+ Eng.ExecuteWorkList(mgr.getStackFrame(D));
+
+ // Visualize the exploded graph.
+ if (mgr.shouldVisualizeGraphviz())
+ Eng.ViewGraph(mgr.shouldTrimGraph());
+
+ // Display warnings.
+ Eng.getBugReporter().FlushReports();
}
//===----------------------------------------------------------------------===//