[ms-inline asm] Add support for using offsetof operator with variables that use

namespace alias qualifiers.  Test case coming on clang side shortly.
Part of rdar://13499009


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179339 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier 2013-04-11 23:37:34 +00:00
parent 4df1854f26
commit 5ea1ea8db8

View File

@ -1411,9 +1411,14 @@ X86Operand *X86AsmParser::ParseIntelOffsetOfOperator() {
const MCExpr *Val;
SMLoc Start = Tok.getLoc(), End;
StringRef Identifier = Tok.getString();
if (getParser().parsePrimaryExpr(Val, End))
return ErrorOperand(Start, "Unable to parse expression!");
const MCExpr *Disp = 0;
if (X86Operand *Err = ParseIntelVarWithQualifier(Disp, Identifier))
return Err;
// Don't emit the offset operator.
InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, OffsetOfLoc, 7));
@ -1421,10 +1426,8 @@ X86Operand *X86AsmParser::ParseIntelOffsetOfOperator() {
// register operand to ensure proper matching. Just pick a GPR based on
// the size of a pointer.
unsigned RegNo = is64BitMode() ? X86::RBX : X86::EBX;
unsigned Len = End.getPointer() - Start.getPointer();
StringRef SymName(Start.getPointer(), Len);
return X86Operand::CreateReg(RegNo, Start, End, /*GetAddress=*/true,
OffsetOfLoc, SymName);
OffsetOfLoc, Identifier);
}
enum IntelOperatorKind {