[cfe-commits] r172127 - /cfe/trunk/lib/Driver/ToolChains.cpp

Will Dietz wdietz2 at illinois.edu
Thu Jan 10 14:20:03 PST 2013


Author: wdietz2
Date: Thu Jan 10 16:20:02 2013
New Revision: 172127

URL: http://llvm.org/viewvc/llvm-project?rev=172127&view=rev
Log:
ToolChains: Minor touchup to use correct type, avoid truncation.

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).

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=172127&r1=172126&r2=172127&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Jan 10 16:20:02 2013
@@ -952,7 +952,7 @@
   // 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)





More information about the cfe-commits mailing list