Skip to content

Commit

Permalink
- The extract tool now is sure to extract the function implementatio…
Browse files Browse the repository at this point in the history
…n for

    the specified name instead of extracting the prototype if both exist.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4045 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Oct 6, 2002
1 parent f6ffcb6 commit 7d3f867
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tools/extract/extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ struct FunctionExtractorPass : public Pass {
// functions that are not the named function.
for (Module::iterator I = M.begin(), E = M.end(); I != E;)
// Check to see if this is the named function!
if (!Named && I->getName() == ExtractFunc) {
if (I->getName() == ExtractFunc && !I->isExternal()) {
if (Named) { // Two functions, same name?
std::cerr << "extract ERROR: Two functions named: '" << ExtractFunc
<< "' found!\n";
exit(1);
}

// Yes, it is. Keep track of it...
Named = I;

Expand Down
8 changes: 7 additions & 1 deletion tools/llvm-extract/llvm-extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ struct FunctionExtractorPass : public Pass {
// functions that are not the named function.
for (Module::iterator I = M.begin(), E = M.end(); I != E;)
// Check to see if this is the named function!
if (!Named && I->getName() == ExtractFunc) {
if (I->getName() == ExtractFunc && !I->isExternal()) {
if (Named) { // Two functions, same name?
std::cerr << "extract ERROR: Two functions named: '" << ExtractFunc
<< "' found!\n";
exit(1);
}

// Yes, it is. Keep track of it...
Named = I;

Expand Down

0 comments on commit 7d3f867

Please sign in to comment.