r225600 - Basic: The asm constraint '+#r' isn't valid, reject it

David Majnemer david.majnemer at gmail.com
Sun Jan 11 00:52:38 PST 2015


Author: majnemer
Date: Sun Jan 11 02:52:38 2015
New Revision: 225600

URL: http://llvm.org/viewvc/llvm-project?rev=225600&view=rev
Log:
Basic: The asm constraint '+#r' isn't valid, reject it

Modified:
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/test/Sema/asm.c

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=225600&r1=225599&r2=225600&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sun Jan 11 02:52:38 2015
@@ -486,9 +486,13 @@ bool TargetInfo::validateOutputConstrain
       if (Name[1] == '=' || Name[1] == '+')
         Name++;
       break;
+    case '#': // Ignore as constraint.
+      while (Name[1] && Name[1] != ',')
+        Name++;
+      if (Name[1] != ',')
+        return false;
     case '?': // Disparage slightly code.
     case '!': // Disparage severely.
-    case '#': // Ignore as constraint.
     case '*': // Ignore for choosing register preferences.
       break;  // Pass them.
     }

Modified: cfe/trunk/test/Sema/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=225600&r1=225599&r2=225600&view=diff
==============================================================================
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Sun Jan 11 02:52:38 2015
@@ -177,3 +177,9 @@ void fn2() {
  __asm__(""
           : "+&m"(l)); // expected-error {{invalid output constraint '+&m' in asm}}
 }
+
+void fn3() {
+  int l;
+ __asm__(""
+          : "+#r"(l)); // expected-error {{invalid output constraint '+#r' in asm}}
+}





More information about the cfe-commits mailing list