Make the loop termination condition clear when building the set of items to

pass to the Linker::LinkInItems function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18894 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-12-13 17:18:19 +00:00
parent 2a3af750e7
commit 05f7e7991b
2 changed files with 3 additions and 6 deletions

View File

@ -173,7 +173,7 @@ static void BuildLinkItems(
cl::list<std::string>::const_iterator libIt = Libraries.begin();
int libPos = -1, filePos = -1;
while ( 1 ) {
while ( libIt != Libraries.end() || fileIt != Files.end() ) {
if (libIt != Libraries.end())
libPos = Libraries.getPosition(libIt - Libraries.begin());
else
@ -189,11 +189,10 @@ static void BuildLinkItems(
} else if (libPos != -1 && (filePos == -1 || libPos < filePos)) {
// Add a library
Items.push_back(std::make_pair(*libIt++, true));
} else {
break; // we're done with the list
}
}
}
int main(int argc, char **argv, char **envp) {
cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
sys::PrintStackTraceOnErrorSignal();

View File

@ -390,7 +390,7 @@ static void BuildLinkItems(
cl::list<std::string>::const_iterator libIt = Libraries.begin();
int libPos = -1, filePos = -1;
while ( 1 ) {
while ( libIt != Libraries.end() || fileIt != Files.end() ) {
if (libIt != Libraries.end())
libPos = Libraries.getPosition(libIt - Libraries.begin());
else
@ -406,8 +406,6 @@ static void BuildLinkItems(
} else if (libPos != -1 && (filePos == -1 || libPos < filePos)) {
// Add a library
Items.push_back(std::make_pair(*libIt++, true));
} else {
break; // we're done with the list
}
}
}