From 6ce33d67e2ed4f8c9395a807bebd25be04580c0f Mon Sep 17 00:00:00 2001 From: Stuart Hastings Date: Wed, 8 Jun 2011 16:06:31 +0000 Subject: [PATCH] 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 --- include/clang/Basic/TargetInfo.h | 3 +++ lib/Basic/Targets.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 5b6d745f15..76006d4292 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -368,6 +368,9 @@ public: 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 82f5df1cf1..dd167dca47 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -2054,7 +2054,7 @@ public: 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: -- 2.50.1