Change CallGraph::Prog to be a reference. idx::Program means to be a global object to the Index library.

llvm-svn: 107461
This commit is contained in:
Zhongxing Xu 2010-07-02 06:39:46 +00:00
parent 609f8c584a
commit a74c22daec
3 changed files with 6 additions and 4 deletions

View File

@ -31,6 +31,8 @@ int main(int argc, char **argv) {
FileManager FileMgr;
std::vector<ASTUnit*> ASTUnits;
Program Prog;
if (InputFilenames.empty())
return 0;
@ -47,7 +49,7 @@ int main(int argc, char **argv) {
}
llvm::OwningPtr<CallGraph> CG;
CG.reset(new CallGraph());
CG.reset(new CallGraph(Prog));
for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
CG->addTU(ASTUnits[i]->getASTContext());

View File

@ -54,7 +54,7 @@ public:
class CallGraph {
/// Program manages all Entities.
idx::Program Prog;
idx::Program &Prog;
typedef std::map<idx::Entity, CallGraphNode *> FunctionMapTy;
@ -71,7 +71,7 @@ class CallGraph {
CallGraphNode *ExternalCallingNode;
public:
CallGraph();
CallGraph(idx::Program &P);
~CallGraph();
typedef FunctionMapTy::iterator iterator;

View File

@ -55,7 +55,7 @@ void CGBuilder::VisitCallExpr(CallExpr *CE) {
}
}
CallGraph::CallGraph() : Root(0) {
CallGraph::CallGraph(Program &P) : Prog(P), Root(0) {
ExternalCallingNode = getOrInsertFunction(Entity());
}