aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-09-11 04:13:42 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-09-11 04:13:42 +0000
commit66847a2826c97b8e09aec304a0a7b4fe1dc35969 (patch)
treef4910d73e871736b40d97210223ce21988e3928e /lib
parentcce6ebc4edde2a9468daabc2b5d18bd2e9b6219e (diff)
Start to add a new transfer function that inlines callee. To be continued.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/CallInliner.cpp41
-rw-r--r--lib/Frontend/AnalysisConsumer.cpp22
2 files changed, 63 insertions, 0 deletions
diff --git a/lib/Analysis/CallInliner.cpp b/lib/Analysis/CallInliner.cpp
new file mode 100644
index 0000000000..344d14d4bb
--- /dev/null
+++ b/lib/Analysis/CallInliner.cpp
@@ -0,0 +1,41 @@
+//===--- CallInliner.cpp - Transfer function that inlines callee ----------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the callee inlining transfer function.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
+
+using namespace clang;
+
+namespace {
+
+class VISIBILITY_HIDDEN CallInliner : public GRTransferFuncs {
+ ASTContext &Ctx;
+public:
+ CallInliner(ASTContext &ctx) : Ctx(ctx) {}
+
+ void EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine,
+ GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L,
+ ExplodedNode* Pred);
+
+};
+
+}
+
+void CallInliner::EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine,
+ GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L,
+ ExplodedNode* Pred) {
+ assert(0 && "TO BE IMPLEMENTED");
+}
+
+GRTransferFuncs *clang::CreateCallInliner(ASTContext &ctx) {
+ return new CallInliner(ctx);
+}
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp
index 67328da661..034ff93f41 100644
--- a/lib/Frontend/AnalysisConsumer.cpp
+++ b/lib/Frontend/AnalysisConsumer.cpp
@@ -412,6 +412,28 @@ static void ActionWarnObjCMethSigs(AnalysisManager& mgr, Decl *D) {
CheckObjCInstMethSignature(cast<ObjCImplementationDecl>(D), BR);
}
+static void ActionInlineCall(AnalysisManager &mgr, Decl *D) {
+ if (!D)
+ return;
+
+ llvm::OwningPtr<GRTransferFuncs> TF(CreateCallInliner(mgr.getASTContext()));
+
+ // Construct the analysis engine.
+ GRExprEngine Eng(mgr);
+
+ Eng.setTransferFunctions(TF.get());
+
+ Eng.RegisterInternalChecks();
+ RegisterAppleChecks(Eng, *D);
+
+ // Execute the worklist algorithm.
+ Eng.ExecuteWorkList(mgr.getStackFrame(D));
+
+ // Visualize the exploded graph.
+ if (mgr.shouldVisualizeGraphviz())
+ Eng.ViewGraph(mgr.shouldTrimGraph());
+}
+
//===----------------------------------------------------------------------===//
// AnalysisConsumer creation.
//===----------------------------------------------------------------------===//