summaryrefslogtreecommitdiff
path: root/lib/Analysis/CallGraph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/CallGraph.cpp')
-rw-r--r--lib/Analysis/CallGraph.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Analysis/CallGraph.cpp b/lib/Analysis/CallGraph.cpp
index ff5242f69a1b..ac3ea2b73fed 100644
--- a/lib/Analysis/CallGraph.cpp
+++ b/lib/Analysis/CallGraph.cpp
@@ -8,12 +8,20 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/CallGraph.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/CallSite.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -125,7 +133,6 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) {
/// This does not rescan the body of the function, so it is suitable when
/// splicing the body of the old function to the new while also updating all
/// callers from old to new.
-///
void CallGraph::spliceFunction(const Function *From, const Function *To) {
assert(FunctionMap.count(From) && "No CallGraphNode for function!");
assert(!FunctionMap.count(To) &&
@@ -256,7 +263,7 @@ CallGraphWrapperPass::CallGraphWrapperPass() : ModulePass(ID) {
initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry());
}
-CallGraphWrapperPass::~CallGraphWrapperPass() {}
+CallGraphWrapperPass::~CallGraphWrapperPass() = default;
void CallGraphWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -291,8 +298,10 @@ void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
#endif
namespace {
+
struct CallGraphPrinterLegacyPass : public ModulePass {
static char ID; // Pass ID, replacement for typeid
+
CallGraphPrinterLegacyPass() : ModulePass(ID) {
initializeCallGraphPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
}
@@ -301,12 +310,14 @@ struct CallGraphPrinterLegacyPass : public ModulePass {
AU.setPreservesAll();
AU.addRequiredTransitive<CallGraphWrapperPass>();
}
+
bool runOnModule(Module &M) override {
getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
return false;
}
};
-}
+
+} // end anonymous namespace
char CallGraphPrinterLegacyPass::ID = 0;