mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
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
This commit is contained in:
parent
dbb1735673
commit
100d6daca4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user