Basic: The asm constraint '#m' isn't valid, reject it

llvm-svn: 225603
This commit is contained in:
David Majnemer 2015-01-11 09:39:03 +00:00
parent f1fdf4a80c
commit c71a566d00
2 changed files with 14 additions and 1 deletions

View File

@ -491,6 +491,7 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
Name++;
if (Name[1] != ',')
return false;
break;
case '?': // Disparage slightly code.
case '!': // Disparage severely.
case '*': // Ignore for choosing register preferences.
@ -623,9 +624,14 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
break;
case ',': // multiple alternative constraint. Ignore comma.
break;
case '#': // Ignore as constraint.
while (Name[1] && Name[1] != ',')
Name++;
if (Name[1] != ',')
return false;
break;
case '?': // Disparage slightly code.
case '!': // Disparage severely.
case '#': // Ignore as constraint.
case '*': // Ignore for choosing register preferences.
break; // Pass them.
}

View File

@ -183,3 +183,10 @@ void fn3() {
__asm__(""
: "+#r"(l)); // expected-error {{invalid output constraint '+#r' in asm}}
}
void fn4() {
int l;
__asm__(""
: "=r"(l)
: "#m"(l)); // expected-error {{invalid input constraint '#m' in asm}}
}