llvm.org GIT mirror llvm / 307f17b
MCParser: introduce Note and use it for ARM AsmParser Introduce a new virtual method Note into the AsmParser. This completements the existing Warning and Error methods. Use the new method to clean up the output of the unwind routines in the ARM AsmParser. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198661 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
5 changed file(s) with 24 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
117117 const MCInstPrinter *IP,
118118 MCAsmParserSemaCallback &SI) = 0;
119119
120 /// Note - Emit a note at the location \p L, with the message \p Msg.
121 virtual void Note(SMLoc L, const Twine &Msg,
122 ArrayRef Ranges = None) = 0;
123
120124 /// Warning - Emit a warning at the location \p L, with the message \p Msg.
121125 ///
122126 /// \return The return value is true, if warnings are fatal.
210210 AssemblerDialect = i;
211211 }
212212
213 virtual void Note(SMLoc L, const Twine &Msg, ArrayRef Ranges = None);
213214 virtual bool Warning(SMLoc L, const Twine &Msg,
214215 ArrayRef Ranges = None);
215216 virtual bool Error(SMLoc L, const Twine &Msg,
534535 it != ie; ++it)
535536 printMessage((*it)->InstantiationLoc, SourceMgr::DK_Note,
536537 "while in macro instantiation");
538 }
539
540 void AsmParser::Note(SMLoc L, const Twine &Msg, ArrayRef Ranges) {
541 printMessage(L, SourceMgr::DK_Note, Msg, Ranges);
542 printMacroInstantiations();
537543 }
538544
539545 bool AsmParser::Warning(SMLoc L, const Twine &Msg, ArrayRef Ranges) {
189189 MCAsmParser &getParser() const { return Parser; }
190190 MCAsmLexer &getLexer() const { return Parser.getLexer(); }
191191
192 void Note(SMLoc L, const Twine &Msg, ArrayRef Ranges = None) {
193 return Parser.Note(L, Msg, Ranges);
194 }
192195 bool Warning(SMLoc L, const Twine &Msg,
193196 ArrayRef Ranges = None) {
194197 return Parser.Warning(L, Msg, Ranges);
82448247 bool ARMAsmParser::parseDirectiveFnStart(SMLoc L) {
82458248 if (FnStartLoc.isValid()) {
82468249 Error(L, ".fnstart starts before the end of previous one");
8247 Error(FnStartLoc, "previous .fnstart starts here");
8250 Note(FnStartLoc, "previous .fnstart starts here");
82488251 return false;
82498252 }
82508253
82798282 }
82808283 if (HandlerDataLoc.isValid()) {
82818284 Error(L, ".cantunwind can't be used with .handlerdata directive");
8282 Error(HandlerDataLoc, ".handlerdata was specified here");
8285 Note(HandlerDataLoc, ".handlerdata was specified here");
82838286 return false;
82848287 }
82858288 if (PersonalityLoc.isValid()) {
82868289 Error(L, ".cantunwind can't be used with .personality directive");
8287 Error(PersonalityLoc, ".personality was specified here");
8290 Note(PersonalityLoc, ".personality was specified here");
82888291 return false;
82898292 }
82908293
83038306 }
83048307 if (CantUnwindLoc.isValid()) {
83058308 Error(L, ".personality can't be used with .cantunwind directive");
8306 Error(CantUnwindLoc, ".cantunwind was specified here");
8309 Note(CantUnwindLoc, ".cantunwind was specified here");
83078310 return false;
83088311 }
83098312 if (HandlerDataLoc.isValid()) {
83108313 Error(L, ".personality must precede .handlerdata directive");
8311 Error(HandlerDataLoc, ".handlerdata was specified here");
8314 Note(HandlerDataLoc, ".handlerdata was specified here");
83128315 return false;
83138316 }
83148317
83378340 }
83388341 if (CantUnwindLoc.isValid()) {
83398342 Error(L, ".handlerdata can't be used with .cantunwind directive");
8340 Error(CantUnwindLoc, ".cantunwind was specified here");
8343 Note(CantUnwindLoc, ".cantunwind was specified here");
83418344 return false;
83428345 }
83438346
2323 @ CHECK: error: .personality can't be used with .cantunwind directive
2424 @ CHECK: .personality __gxx_personality_v0
2525 @ CHECK: ^
26 @ CHECK: error: .cantunwind was specified here
26 @ CHECK: note: .cantunwind was specified here
2727 @ CHECK: .cantunwind
2828 @ CHECK: ^
2929 .fnend
4343 @ CHECK: error: .handlerdata can't be used with .cantunwind directive
4444 @ CHECK: .handlerdata
4545 @ CHECK: ^
46 @ CHECK: error: .cantunwind was specified here
46 @ CHECK: note: .cantunwind was specified here
4747 @ CHECK: .cantunwind
4848 @ CHECK: ^
4949 .fnend
6363 @ CHECK: error: .cantunwind can't be used with .personality directive
6464 @ CHECK: .cantunwind
6565 @ CHECK: ^
66 @ CHECK: error: .personality was specified here
66 @ CHECK: note: .personality was specified here
6767 @ CHECK: .personality __gxx_personality_v0
6868 @ CHECK: ^
6969 .fnend
8383 @ CHECK: error: .cantunwind can't be used with .handlerdata directive
8484 @ CHECK: .cantunwind
8585 @ CHECK: ^
86 @ CHECK: error: .handlerdata was specified here
86 @ CHECK: note: .handlerdata was specified here
8787 @ CHECK: .handlerdata
8888 @ CHECK: ^
8989 .fnend
2323 @ CHECK: error: .fnstart starts before the end of previous one
2424 @ CHECK: .fnstart
2525 @ CHECK: ^
26 @ CHECK: error: previous .fnstart starts here
26 @ CHECK: note: previous .fnstart starts here
2727 @ CHECK: .fnstart
2828 @ CHECK: ^
2929 func2: