mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 15:02:16 +00:00
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. llvm-svn: 198661
This commit is contained in:
parent
df983a7565
commit
3d4218e538
@ -118,6 +118,10 @@ public:
|
|||||||
const MCInstPrinter *IP,
|
const MCInstPrinter *IP,
|
||||||
MCAsmParserSemaCallback &SI) = 0;
|
MCAsmParserSemaCallback &SI) = 0;
|
||||||
|
|
||||||
|
/// Note - Emit a note at the location \p L, with the message \p Msg.
|
||||||
|
virtual void Note(SMLoc L, const Twine &Msg,
|
||||||
|
ArrayRef<SMRange> Ranges = None) = 0;
|
||||||
|
|
||||||
/// Warning - Emit a warning at the location \p L, with the message \p Msg.
|
/// Warning - Emit a warning at the location \p L, with the message \p Msg.
|
||||||
///
|
///
|
||||||
/// \return The return value is true, if warnings are fatal.
|
/// \return The return value is true, if warnings are fatal.
|
||||||
|
@ -211,6 +211,7 @@ public:
|
|||||||
AssemblerDialect = i;
|
AssemblerDialect = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void Note(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges = None);
|
||||||
virtual bool Warning(SMLoc L, const Twine &Msg,
|
virtual bool Warning(SMLoc L, const Twine &Msg,
|
||||||
ArrayRef<SMRange> Ranges = None);
|
ArrayRef<SMRange> Ranges = None);
|
||||||
virtual bool Error(SMLoc L, const Twine &Msg,
|
virtual bool Error(SMLoc L, const Twine &Msg,
|
||||||
@ -537,6 +538,11 @@ void AsmParser::printMacroInstantiations() {
|
|||||||
"while in macro instantiation");
|
"while in macro instantiation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsmParser::Note(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) {
|
||||||
|
printMessage(L, SourceMgr::DK_Note, Msg, Ranges);
|
||||||
|
printMacroInstantiations();
|
||||||
|
}
|
||||||
|
|
||||||
bool AsmParser::Warning(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) {
|
bool AsmParser::Warning(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) {
|
||||||
if (FatalAssemblerWarnings)
|
if (FatalAssemblerWarnings)
|
||||||
return Error(L, Msg, Ranges);
|
return Error(L, Msg, Ranges);
|
||||||
|
@ -190,6 +190,9 @@ class ARMAsmParser : public MCTargetAsmParser {
|
|||||||
MCAsmParser &getParser() const { return Parser; }
|
MCAsmParser &getParser() const { return Parser; }
|
||||||
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
|
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
|
||||||
|
|
||||||
|
void Note(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges = None) {
|
||||||
|
return Parser.Note(L, Msg, Ranges);
|
||||||
|
}
|
||||||
bool Warning(SMLoc L, const Twine &Msg,
|
bool Warning(SMLoc L, const Twine &Msg,
|
||||||
ArrayRef<SMRange> Ranges = None) {
|
ArrayRef<SMRange> Ranges = None) {
|
||||||
return Parser.Warning(L, Msg, Ranges);
|
return Parser.Warning(L, Msg, Ranges);
|
||||||
@ -8245,7 +8248,7 @@ bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
|
|||||||
bool ARMAsmParser::parseDirectiveFnStart(SMLoc L) {
|
bool ARMAsmParser::parseDirectiveFnStart(SMLoc L) {
|
||||||
if (FnStartLoc.isValid()) {
|
if (FnStartLoc.isValid()) {
|
||||||
Error(L, ".fnstart starts before the end of previous one");
|
Error(L, ".fnstart starts before the end of previous one");
|
||||||
Error(FnStartLoc, "previous .fnstart starts here");
|
Note(FnStartLoc, "previous .fnstart starts here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8280,12 +8283,12 @@ bool ARMAsmParser::parseDirectiveCantUnwind(SMLoc L) {
|
|||||||
}
|
}
|
||||||
if (HandlerDataLoc.isValid()) {
|
if (HandlerDataLoc.isValid()) {
|
||||||
Error(L, ".cantunwind can't be used with .handlerdata directive");
|
Error(L, ".cantunwind can't be used with .handlerdata directive");
|
||||||
Error(HandlerDataLoc, ".handlerdata was specified here");
|
Note(HandlerDataLoc, ".handlerdata was specified here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PersonalityLoc.isValid()) {
|
if (PersonalityLoc.isValid()) {
|
||||||
Error(L, ".cantunwind can't be used with .personality directive");
|
Error(L, ".cantunwind can't be used with .personality directive");
|
||||||
Error(PersonalityLoc, ".personality was specified here");
|
Note(PersonalityLoc, ".personality was specified here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8304,12 +8307,12 @@ bool ARMAsmParser::parseDirectivePersonality(SMLoc L) {
|
|||||||
}
|
}
|
||||||
if (CantUnwindLoc.isValid()) {
|
if (CantUnwindLoc.isValid()) {
|
||||||
Error(L, ".personality can't be used with .cantunwind directive");
|
Error(L, ".personality can't be used with .cantunwind directive");
|
||||||
Error(CantUnwindLoc, ".cantunwind was specified here");
|
Note(CantUnwindLoc, ".cantunwind was specified here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (HandlerDataLoc.isValid()) {
|
if (HandlerDataLoc.isValid()) {
|
||||||
Error(L, ".personality must precede .handlerdata directive");
|
Error(L, ".personality must precede .handlerdata directive");
|
||||||
Error(HandlerDataLoc, ".handlerdata was specified here");
|
Note(HandlerDataLoc, ".handlerdata was specified here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8338,7 +8341,7 @@ bool ARMAsmParser::parseDirectiveHandlerData(SMLoc L) {
|
|||||||
}
|
}
|
||||||
if (CantUnwindLoc.isValid()) {
|
if (CantUnwindLoc.isValid()) {
|
||||||
Error(L, ".handlerdata can't be used with .cantunwind directive");
|
Error(L, ".handlerdata can't be used with .cantunwind directive");
|
||||||
Error(CantUnwindLoc, ".cantunwind was specified here");
|
Note(CantUnwindLoc, ".cantunwind was specified here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ func1:
|
|||||||
@ CHECK: error: .personality can't be used with .cantunwind directive
|
@ CHECK: error: .personality can't be used with .cantunwind directive
|
||||||
@ CHECK: .personality __gxx_personality_v0
|
@ CHECK: .personality __gxx_personality_v0
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
@ CHECK: error: .cantunwind was specified here
|
@ CHECK: note: .cantunwind was specified here
|
||||||
@ CHECK: .cantunwind
|
@ CHECK: .cantunwind
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
.fnend
|
.fnend
|
||||||
@ -44,7 +44,7 @@ func2:
|
|||||||
@ CHECK: error: .handlerdata can't be used with .cantunwind directive
|
@ CHECK: error: .handlerdata can't be used with .cantunwind directive
|
||||||
@ CHECK: .handlerdata
|
@ CHECK: .handlerdata
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
@ CHECK: error: .cantunwind was specified here
|
@ CHECK: note: .cantunwind was specified here
|
||||||
@ CHECK: .cantunwind
|
@ CHECK: .cantunwind
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
.fnend
|
.fnend
|
||||||
@ -64,7 +64,7 @@ func3:
|
|||||||
@ CHECK: error: .cantunwind can't be used with .personality directive
|
@ CHECK: error: .cantunwind can't be used with .personality directive
|
||||||
@ CHECK: .cantunwind
|
@ CHECK: .cantunwind
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
@ CHECK: error: .personality was specified here
|
@ CHECK: note: .personality was specified here
|
||||||
@ CHECK: .personality __gxx_personality_v0
|
@ CHECK: .personality __gxx_personality_v0
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
.fnend
|
.fnend
|
||||||
@ -84,7 +84,7 @@ func4:
|
|||||||
@ CHECK: error: .cantunwind can't be used with .handlerdata directive
|
@ CHECK: error: .cantunwind can't be used with .handlerdata directive
|
||||||
@ CHECK: .cantunwind
|
@ CHECK: .cantunwind
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
@ CHECK: error: .handlerdata was specified here
|
@ CHECK: note: .handlerdata was specified here
|
||||||
@ CHECK: .handlerdata
|
@ CHECK: .handlerdata
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
.fnend
|
.fnend
|
||||||
|
@ -24,7 +24,7 @@ func1:
|
|||||||
@ CHECK: error: .fnstart starts before the end of previous one
|
@ CHECK: error: .fnstart starts before the end of previous one
|
||||||
@ CHECK: .fnstart
|
@ CHECK: .fnstart
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
@ CHECK: error: previous .fnstart starts here
|
@ CHECK: note: previous .fnstart starts here
|
||||||
@ CHECK: .fnstart
|
@ CHECK: .fnstart
|
||||||
@ CHECK: ^
|
@ CHECK: ^
|
||||||
func2:
|
func2:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user