summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-22 19:14:29 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-22 19:14:29 +0000
commitcf172e5e288a93130d8fe8ec43dc8ef51ab48e8b (patch)
treee4bad68eed64723dbdf62b38ec1b61d19cfd98d3 /llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
parentc4aecf9994444e1907670a39e72c25b3b76cbb97 (diff)
downloadbcm5719-llvm-cf172e5e288a93130d8fe8ec43dc8ef51ab48e8b.tar.gz
bcm5719-llvm-cf172e5e288a93130d8fe8ec43dc8ef51ab48e8b.zip
[ms-inline asm] Avoid a false positive assertion
Assertion failed: (Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!") when parsing inline asm. SMLoc assumes that the first char * in the source is invalid. However, when parsing an inline asm the mnemonic is at this location. I don't want to change SMLoc, so use a trivial workaround. llvm-svn: 162381
Diffstat (limited to 'llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 73a00950ac1..8c9a02ff22c 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1677,8 +1677,10 @@ MatchInstruction(SMLoc IDLoc,
if ((Match1 == Match_MnemonicFail) && (Match2 == Match_MnemonicFail) &&
(Match3 == Match_MnemonicFail) && (Match4 == Match_MnemonicFail)) {
if (!WasOriginallyInvalidOperand) {
+ ArrayRef<SMRange> Ranges = matchingInlineAsm ? EmptyRanges :
+ Op->getLocRange();
return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'",
- Op->getLocRange(), matchingInlineAsm);
+ Ranges, matchingInlineAsm);
}
// Recover location info for the operand if we know which was the problem.
OpenPOWER on IntegriCloud