#include "llvm/Module.h"
#include "llvm/Instructions.h"
#include "llvm/Support/CallSite.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
#include <ostream>
using namespace llvm;
//===----------------------------------------------------------------------===//
// BasicCallGraph class definition
//
-class BasicCallGraph : public CallGraph, public ModulePass {
+class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass {
// Root is root of the call graph, or the external node if a 'main' function
// couldn't be found.
//
CallGraphNode *CallsExternalNode;
public:
- BasicCallGraph() : Root(0), ExternalCallingNode(0), CallsExternalNode(0) {}
+ static char ID; // Class identification, replacement for typeinfo
+ BasicCallGraph() : ModulePass((intptr_t)&ID), Root(0),
+ ExternalCallingNode(0), CallsExternalNode(0) {}
// runOnModule - Compute the call graph for the specified module.
virtual bool runOnModule(Module &M) {
AU.setPreservesAll();
}
- void print(OStream &o, const Module *M) const {
- if (o.stream()) print(*o.stream(), M);
+ void print(std::ostream *o, const Module *M) const {
+ if (o) print(*o, M);
}
virtual void print(std::ostream &o, const Module *M) const {
// If this function is not defined in this translation unit, it could call
// anything.
- if (F->isExternal() && !F->getIntrinsicID())
+ if (F->isDeclaration() && !F->getIntrinsicID())
Node->addCalledFunction(CallSite(), CallsExternalNode);
// Loop over all of the users of the function... looking for callers...
} //End anonymous namespace
+char CallGraph::ID = 0;
+char BasicCallGraph::ID = 0;
+
void CallGraph::initialize(Module &M) {
Mod = &M;
}