Revert "[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides"

This reverts r308867 and r308866.

It broke the sanitizer-windows buildbot on C++ code similar to the
following:

  namespace cl { }
  void f() {
    __asm {
      mov al, cl
    }
  }

t.cpp(4,13):  error: unexpected namespace name 'cl': expected expression
    mov al, cl
            ^

In this case, MSVC parses 'cl' as a register, not a namespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308926 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner 2017-07-24 20:48:15 +00:00
parent 04cdb2eeb4
commit c2060a50ef

View File

@ -944,8 +944,7 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo,
EndLoc = Tok.getEndLoc();
if (Tok.isNot(AsmToken::Identifier)) {
if (isParsingIntelSyntax())
return true;
if (isParsingIntelSyntax()) return true;
return Error(StartLoc, "invalid register name",
SMRange(StartLoc, EndLoc));
}
@ -956,16 +955,6 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo,
if (RegNo == 0)
RegNo = MatchRegisterName(Tok.getString().lower());
// In MS inline-asm we allow variables to be named as registers, and
// give them precedence over actual registers
// However - we require the match to be case sensitive
if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo) {
StringRef LineBuf(Tok.getIdentifier().data());
InlineAsmIdentifierInfo Info;
if (SemaCallback->LookupInlineAsmIdentifier(LineBuf, Info, false))
return true;
}
// The "flags" register cannot be referenced directly.
// Treat it as an identifier instead.
if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo == X86::EFLAGS)