aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-28 05:48:34 +0000
committerChris Lattner <sabre@nondot.org>2002-04-28 05:48:34 +0000
commit100d6daca4e6b762735b32bb2a00ee32945e2a82 (patch)
tree4ec60e509b1b9c9bd215289f70b4a459498cc8c6
parentdbb1735673ed177a85f04698b9cd89f2dc1b4e91 (diff)
downloadexternal_llvm-100d6daca4e6b762735b32bb2a00ee32945e2a82.zip
external_llvm-100d6daca4e6b762735b32bb2a00ee32945e2a82.tar.gz
external_llvm-100d6daca4e6b762735b32bb2a00ee32945e2a82.tar.bz2
Be careful not to make "external" function internal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2363 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/Internalize.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index aadde7c..8bb1a9c 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -15,7 +15,7 @@ class InternalizePass : public Pass {
virtual bool run(Module *M) {
bool FoundMain = false; // Look for a function named main...
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
- if ((*I)->getName() == "main") {
+ if ((*I)->getName() == "main" && !(*I)->isExternal()) {
FoundMain = true;
break;
}
@@ -26,7 +26,8 @@ class InternalizePass : public Pass {
// Found a main function, mark all functions not named main as internal.
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
- if ((*I)->getName() != "main") // Leave the main function external
+ if ((*I)->getName() != "main" && // Leave the main function external
+ !(*I)->isExternal()) // Function must be defined here
(*I)->setInternalLinkage(Changed = true);
return Changed;