aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-config/llvm-config.cpp
diff options
context:
space:
mode:
authorMarcello Maggioni <hayarms@gmail.com>2017-01-12 19:47:38 +0000
committerMarcello Maggioni <hayarms@gmail.com>2017-01-12 19:47:38 +0000
commita5f1ff1afadbcff2f90757828b5f8a1147521c1c (patch)
tree47f5046870e76392ce279027f4e56a0ca8157de3 /llvm/tools/llvm-config/llvm-config.cpp
parent6684aeb13701880734279043e8deb75976adef8c (diff)
downloadllvm-a5f1ff1afadbcff2f90757828b5f8a1147521c1c.zip
llvm-a5f1ff1afadbcff2f90757828b5f8a1147521c1c.tar.gz
llvm-a5f1ff1afadbcff2f90757828b5f8a1147521c1c.tar.bz2
[llvm-config] Fix obviously wrong code in parsing DyLib components.
The code parsing the string was using the offset returned from StringRef::find() wrong, assuming it was relative to the staring offset that is passed to the function, but the returned offset is always relative to the beginning of the line. This causes odd behaviour while parsing the component string. Spotted thanks to the newly added test: tools/llvm-config/booleans.test llvm-svn: 291803
Diffstat (limited to 'llvm/tools/llvm-config/llvm-config.cpp')
-rw-r--r--llvm/tools/llvm-config/llvm-config.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 5298245..25344e4 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -242,7 +242,7 @@ std::vector<std::string> GetAllDyLibComponents(const bool IsInDevelopmentTree,
size_t Offset = 0;
while (true) {
const size_t NextOffset = DyLibComponentsStr.find(';', Offset);
- DyLibComponents.push_back(DyLibComponentsStr.substr(Offset, NextOffset));
+ DyLibComponents.push_back(DyLibComponentsStr.substr(Offset, NextOffset-Offset));
if (NextOffset == std::string::npos) {
break;
}