diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-06 21:30:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-06 21:30:04 +0000 |
commit | 7d3f8671c15901df8417acc20c01ca82ff8cc180 (patch) | |
tree | 14eb0f89c32873e560dae4e1a4bc7b03fd6f0442 /tools | |
parent | f6ffcb6b713c259992b68d6b328f1b806775b9fb (diff) | |
download | external_llvm-7d3f8671c15901df8417acc20c01ca82ff8cc180.zip external_llvm-7d3f8671c15901df8417acc20c01ca82ff8cc180.tar.gz external_llvm-7d3f8671c15901df8417acc20c01ca82ff8cc180.tar.bz2 |
- The extract tool now is sure to extract the function implementation 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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/extract/extract.cpp | 8 | ||||
-rw-r--r-- | tools/llvm-extract/llvm-extract.cpp | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/tools/extract/extract.cpp b/tools/extract/extract.cpp index e904bea..b16b4f6 100644 --- a/tools/extract/extract.cpp +++ b/tools/extract/extract.cpp @@ -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; diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index e904bea..b16b4f6 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -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; |