[ms-inline asm] Don't diagnose an empty lookup for inline assmebly. This happen

for labels in inline assembly that aren't in the lookup tables.  E.g.,

  __asm {
   a:
   jmp a
  }

rdar://13983623

llvm-svn: 182659
This commit is contained in:
Chad Rosier 2013-05-24 18:32:55 +00:00
parent f2e021233c
commit b9aff1edb3
4 changed files with 19 additions and 3 deletions

View File

@ -3095,7 +3095,8 @@ public:
SourceLocation TemplateKWLoc, SourceLocation TemplateKWLoc,
UnqualifiedId &Id, UnqualifiedId &Id,
bool HasTrailingLParen, bool IsAddressOfOperand, bool HasTrailingLParen, bool IsAddressOfOperand,
CorrectionCandidateCallback *CCC = 0); CorrectionCandidateCallback *CCC = 0,
bool IsInlineAsmIdentifier = false);
void DecomposeUnqualifiedId(const UnqualifiedId &Id, void DecomposeUnqualifiedId(const UnqualifiedId &Id,
TemplateArgumentListInfo &Buffer, TemplateArgumentListInfo &Buffer,

View File

@ -1821,7 +1821,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S,
UnqualifiedId &Id, UnqualifiedId &Id,
bool HasTrailingLParen, bool HasTrailingLParen,
bool IsAddressOfOperand, bool IsAddressOfOperand,
CorrectionCandidateCallback *CCC) { CorrectionCandidateCallback *CCC,
bool IsInlineAsmIdentifier) {
assert(!(IsAddressOfOperand && HasTrailingLParen) && assert(!(IsAddressOfOperand && HasTrailingLParen) &&
"cannot be direct & operand and have a trailing lparen"); "cannot be direct & operand and have a trailing lparen");
@ -1937,6 +1938,10 @@ ExprResult Sema::ActOnIdExpression(Scope *S,
IsAddressOfOperand, TemplateArgs); IsAddressOfOperand, TemplateArgs);
} }
// Don't diagnose an empty lookup for inline assmebly.
if (IsInlineAsmIdentifier)
return ExprError();
CorrectionCandidateCallback DefaultValidator; CorrectionCandidateCallback DefaultValidator;
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator)) if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator))
return ExprError(); return ExprError();

View File

@ -381,7 +381,9 @@ ExprResult Sema::LookupInlineAsmIdentifier(CXXScopeSpec &SS,
ExprResult Result = ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Id, ExprResult Result = ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Id,
/*trailing lparen*/ false, /*trailing lparen*/ false,
/*is & operand*/ false); /*is & operand*/ false,
/*CorrectionCandidateCallback=*/0,
/*IsInlineAsmIdentifier=*/ true);
if (IsUnevaluatedContext) if (IsUnevaluatedContext)
PopExpressionEvaluationContext(); PopExpressionEvaluationContext();

View File

@ -103,3 +103,11 @@ void test5() {
__asm mov x, eax __asm mov x, eax
// CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, eax", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* [[X]]) // CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, eax", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* [[X]])
} }
// Just verify this doesn't emit an error.
void test6() {
__asm {
a:
jmp a
}
}