Followup to 132737; make two-character string explicit, add some
comments. rdar://problem/9037836
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132752 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 5b6d745..76006d4 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -368,6 +368,9 @@
ConstraintInfo *OutputConstraints,
unsigned NumOutputs, unsigned &Index) const;
+ // Constraint parm will be left pointing at the last character of
+ // the constraint. In practice, it won't be changed unless the
+ // constraint is longer than one character.
virtual std::string convertConstraint(const char *&Constraint) const {
// 'p' defaults to 'r', but can be overridden by targets.
if (*Constraint == 'p')
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 82f5df1..dd167dc 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2054,7 +2054,7 @@
std::string R;
switch (*Constraint) {
case 'U': // Two-character constraint; add "^" hint for later parsing.
- R = std::string("^") + Constraint;
+ R = std::string("^") + std::string(Constraint, 2);
Constraint++;
break;
default: