diff options
author | Chris Lattner <sabre@nondot.org> | 2011-10-16 05:43:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-10-16 05:43:57 +0000 |
commit | 3f2d5f60b31fd057c10f77b2e607b23a8c94f6d3 (patch) | |
tree | e7c36aeb6ce5e3a57764d841e5a0f603b9e12bef /lib/MC/MCParser/AsmParser.cpp | |
parent | d8b7aa26134d2abee777f745c32005e63dea2455 (diff) |
Make SMDiagnostic a little more sane. Instead of passing around note/warning/error as a
string, pass it around as an enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 25f404c703..0be8f51f0c 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -171,10 +171,10 @@ private: void HandleMacroExit(); void PrintMacroInstantiations(); - void PrintMessage(SMLoc Loc, const Twine &Msg, const char *Type, + void PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg, ArrayRef<SMRange> Ranges = ArrayRef<SMRange>(), bool ShowLine = true) const { - SrcMgr.PrintMessage(Loc, Msg, Type, Ranges, ShowLine); + SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges, ShowLine); } static void DiagHandler(const SMDiagnostic &Diag, void *Context); @@ -392,21 +392,21 @@ void AsmParser::PrintMacroInstantiations() { // Print the active macro instantiation stack. for (std::vector<MacroInstantiation*>::const_reverse_iterator it = ActiveMacros.rbegin(), ie = ActiveMacros.rend(); it != ie; ++it) - PrintMessage((*it)->InstantiationLoc, "while in macro instantiation", - "note"); + PrintMessage((*it)->InstantiationLoc, SourceMgr::DK_Note, + "while in macro instantiation"); } bool AsmParser::Warning(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) { if (FatalAssemblerWarnings) return Error(L, Msg, Ranges); - PrintMessage(L, Msg, "warning", Ranges); + PrintMessage(L, SourceMgr::DK_Warning, Msg, Ranges); PrintMacroInstantiations(); return false; } bool AsmParser::Error(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) { HadError = true; - PrintMessage(L, Msg, "error", Ranges); + PrintMessage(L, SourceMgr::DK_Error, Msg, Ranges); PrintMacroInstantiations(); return true; } @@ -498,9 +498,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // FIXME: We would really like to refer back to where the symbol was // first referenced for a source location. We need to add something // to track that. Currently, we just point to the end of the file. - PrintMessage(getLexer().getLoc(), "assembler local symbol '" + - Sym->getName() + "' not defined", "error", - ArrayRef<SMRange>(), false); + PrintMessage(getLexer().getLoc(), SourceMgr::DK_Error, + "assembler local symbol '" + Sym->getName() + + "' not defined"); } } @@ -1203,7 +1203,7 @@ bool AsmParser::ParseStatement() { } OS << "]"; - PrintMessage(IDLoc, OS.str(), "note"); + PrintMessage(IDLoc, SourceMgr::DK_Note, OS.str()); } // If parsing succeeded, match the instruction. @@ -1305,7 +1305,8 @@ void AsmParser::DiagHandler(const SMDiagnostic &Diag, void *Context) { SMDiagnostic NewDiag(*Diag.getSourceMgr(), Diag.getLoc(), Filename, LineNo, Diag.getColumnNo(), - Diag.getMessage(), Diag.getLineContents(), + Diag.getKind(), Diag.getMessage(), + Diag.getLineContents(), Diag.getRanges(), Diag.getShowLine()); NewDiag.print(0, OS); |