summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-13 17:18:19 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-13 17:18:19 +0000
commit05f7e7991b817e46cb0bd387459dcb543e572ce2 (patch)
tree6302023b3752f56b75db01c0fc4b43bd034bb0d3 /tools
parent2a3af750e71f52d464a9d84e1eb11671ccbd53e0 (diff)
downloadllvm-05f7e7991b817e46cb0bd387459dcb543e572ce2.tar.gz
llvm-05f7e7991b817e46cb0bd387459dcb543e572ce2.tar.bz2
llvm-05f7e7991b817e46cb0bd387459dcb543e572ce2.tar.xz
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
Diffstat (limited to 'tools')
-rw-r--r--tools/gccld/gccld.cpp5
-rw-r--r--tools/llvm-ld/llvm-ld.cpp4
2 files changed, 3 insertions, 6 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index db03b208b9..41c176f869 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -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();
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 41d9510d29..8bd2cc8376 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -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
}
}
}