llvm.org GIT mirror llvm / 362a05a
Wire up support for diagnostic ranges in the ARMAsmParser. As an example, attach range info to the "invalid instruction" message: $ clang -arch arm -c asm.c asm.c:2:11: error: invalid instruction __asm__("foo r0"); ^ <inline asm>:1:2: note: instantiated into assembly here foo r0 ^~~ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154765 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 8 years ago
1 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
8181 MCAsmParser &getParser() const { return Parser; }
8282 MCAsmLexer &getLexer() const { return Parser.getLexer(); }
8383
84 void Warning(SMLoc L, const Twine &Msg) { Parser.Warning(L, Msg); }
85 bool Error(SMLoc L, const Twine &Msg) { return Parser.Error(L, Msg); }
84 bool Warning(SMLoc L, const Twine &Msg,
85 ArrayRef Ranges = ArrayRef()) {
86 return Parser.Warning(L, Msg, Ranges);
87 }
88 bool Error(SMLoc L, const Twine &Msg,
89 ArrayRef Ranges = ArrayRef()) {
90 return Parser.Error(L, Msg, Ranges);
91 }
8692
8793 int tryParseRegister();
8894 bool tryParseRegisterWithWriteBack(SmallVectorImpl &);
477483 /// getEndLoc - Get the location of the last token of this operand.
478484 SMLoc getEndLoc() const { return EndLoc; }
479485
486 SMRange getLocRange() const { return SMRange(StartLoc, EndLoc); }
487
480488 ARMCC::CondCodes getCondCode() const {
481489 assert(Kind == k_CondCode && "Invalid access!");
482490 return CC.Val;
73207328 return Error(ErrorLoc, "invalid operand for instruction");
73217329 }
73227330 case Match_MnemonicFail:
7323 return Error(IDLoc, "invalid instruction");
7331 return Error(IDLoc, "invalid instruction",
7332 ((ARMOperand*)Operands[0])->getLocRange());
73247333 case Match_ConversionFail:
73257334 // The converter function will have already emited a diagnostic.
73267335 return true;