- The extract tool now is sure to extract the function implementation for
authorChris Lattner <sabre@nondot.org>
Sun, 6 Oct 2002 21:30:04 +0000 (21:30 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 Oct 2002 21:30:04 +0000 (21:30 +0000)
    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

tools/extract/extract.cpp
tools/llvm-extract/llvm-extract.cpp

index e904beac80c599de71fad7e13730c83df1b8a477..b16b4f609e18b0e6b2e38cf50d76cbeb5acafc36 100644 (file)
@@ -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;
 
index e904beac80c599de71fad7e13730c83df1b8a477..b16b4f609e18b0e6b2e38cf50d76cbeb5acafc36 100644 (file)
@@ -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;