These two conditions are not exclusive!!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8518 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-09-15 04:35:16 +00:00
parent b31247a840
commit f52d01bbc5

View File

@ -64,7 +64,7 @@ CallGraphNode *CallGraph::getNodeFor(Function *F) {
void CallGraph::addToCallGraph(Function *F) { void CallGraph::addToCallGraph(Function *F) {
CallGraphNode *Node = getNodeFor(F); CallGraphNode *Node = getNodeFor(F);
// If this function has external linkage, // If this function has external linkage, anything could call it...
if (!F->hasInternalLinkage()) { if (!F->hasInternalLinkage()) {
ExternalNode->addCalledFunction(Node); ExternalNode->addCalledFunction(Node);
@ -75,10 +75,13 @@ void CallGraph::addToCallGraph(Function *F) {
else else
Root = Node; // Found a main, keep track of it! Root = Node; // Found a main, keep track of it!
} }
} else if (F->isExternal()) { // Not defined in this xlation unit?
Node->addCalledFunction(ExternalNode); // It could call anything...
} }
// If this function is not defined in this translation unit, it could call
// anything.
if (F->isExternal())
Node->addCalledFunction(ExternalNode);
// Loop over all of the users of the function... looking for callers... // Loop over all of the users of the function... looking for callers...
// //
for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I) { for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I) {