Basic: Numeric constraints are multidigit
Clang would treat the digits in an "11m" input constraint separately as
if it was handling constraint 1 twice instead of constraint 11.
llvm-svn: 225606
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 535c87e..84cdaab 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -548,11 +548,17 @@
default:
// Check if we have a matching constraint
if (*Name >= '0' && *Name <= '9') {
- unsigned i = *Name - '0';
+ const char *DigitStart = Name;
+ while (Name[1] >= '0' && Name[1] <= '9')
+ Name++;
+ const char *DigitEnd = Name;
+ unsigned i;
+ if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
+ .getAsInteger(10, i))
+ return false;
// Check if matching constraint is out of bounds.
- if (i >= NumOutputs)
- return false;
+ if (i >= NumOutputs) return false;
// A number must refer to an output only operand.
if (OutputConstraints[i].isReadWrite())