diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-04-11 21:49:30 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-04-11 21:49:30 +0000 |
commit | f06cc981495991d2095ed4066f0eb9c0241c0a61 (patch) | |
tree | 1acfdbe8b25f0041db36a81bffc4d240dd0a0164 /lib/Target/X86/AsmParser/X86AsmParser.cpp | |
parent | 38dd366b307f45815cf03994242555376fa5b50c (diff) | |
download | llvm-f06cc981495991d2095ed4066f0eb9c0241c0a61.tar.gz llvm-f06cc981495991d2095ed4066f0eb9c0241c0a61.tar.bz2 llvm-f06cc981495991d2095ed4066f0eb9c0241c0a61.tar.xz |
[ms-inline asm] Remove brackets from around a symbol reference in the target
specific logic. This makes the code much less fragile. Test case coming on the
clang side in a moment.
rdar://13634327
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmParser/X86AsmParser.cpp')
-rw-r--r-- | lib/Target/X86/AsmParser/X86AsmParser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index f587d36232..aaf571ae9d 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1140,6 +1140,11 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg, if (getLexer().isNot(AsmToken::RBrac)) return ErrorOperand(Tok.getLoc(), "Expected ']' token!"); + if (isParsingInlineAsm()) { + // Remove the '[' and ']' from the IR string. + InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Start, 1)); + InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Tok.getLoc(), 1)); + } unsigned Len = Tok.getLoc().getPointer() - IdentStart.getPointer(); StringRef SymName(IdentStart.getPointer(), Len); Parser.Lex(); // Eat ']' @@ -1211,6 +1216,11 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg, Parser.Lex(); // Consume the token. } } + if (isParsingInlineAsm() && Disp && isa<MCSymbolRefExpr>(Disp)) { + // Remove the '[' and ']' from the IR string. + InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Start, 1)); + InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, End, 1)); + } if (!Disp) Disp = MCConstantExpr::Create(SM.getDisp(), getContext()); |