]> granicus.if.org Git - clang/commitdiff
ToolChains: Minor touchup to use correct type, avoid truncation.
authorWill Dietz <wdietz2@illinois.edu>
Thu, 10 Jan 2013 22:20:02 +0000 (22:20 +0000)
committerWill Dietz <wdietz2@illinois.edu>
Thu, 10 Jan 2013 22:20:02 +0000 (22:20 +0000)
Truncation happens regularly when find_first_not_of returns npos,
strings long enough to trigger bug here are implausible.

No functionality change intended (ignoring absurd string lengths).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172127 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp

index fa217605e9edbadbab4737bee9e05d1945e09291..03a01e3402ff5f218612a03d4878566d00f37728 100644 (file)
@@ -952,7 +952,7 @@ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
   // And retains any patch number it finds.
   StringRef PatchText = GoodVersion.PatchSuffix = Second.second.str();
   if (!PatchText.empty()) {
-    if (unsigned EndNumber = PatchText.find_first_not_of("0123456789")) {
+    if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) {
       // Try to parse the number and any suffix.
       if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) ||
           GoodVersion.Patch < 0)