From ae7ecd6d8f25ac5ef23f49bfa0026936480dcf6d Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 11 Apr 2013 23:37:34 +0000 Subject: [PATCH] [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 llvm-svn: 179339 --- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 6f026cd3798e..946f0e90ff9d 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -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 {