diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-18 07:59:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-18 07:59:24 +0000 |
commit | 3692b09faa9fe346f39bc922db6dce48cdcc3f63 (patch) | |
tree | 345b316a71a538b837efa50e3cdda96182386e0d /lib/Lex/Lexer.cpp | |
parent | ef708fd4abccf4d21b1f82ab2ab62f6ae7cc1265 (diff) |
Convert the lexer and start converting the PP over to using canonical Diag methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 4e93600a87..8ddd62fe99 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -306,11 +306,10 @@ SourceLocation Lexer::getSourceLocation(const char *Loc) const { /// Diag - Forwarding function for diagnostics. This translate a source /// position in the current buffer into a SourceLocation object for rendering. -void Lexer::Diag(const char *Loc, unsigned DiagID, - const std::string &Msg) const { +DiagnosticInfo Lexer::Diag(const char *Loc, unsigned DiagID) const { if (LexingRawMode && Diagnostic::isBuiltinNoteWarningOrExtension(DiagID)) - return; - PP->Diag(getSourceLocation(Loc), DiagID, Msg); + return DiagnosticInfo(0, FullSourceLoc(), 0); + return PP->Diag(getSourceLocation(Loc), DiagID); } //===----------------------------------------------------------------------===// @@ -340,14 +339,14 @@ static char GetTrigraphCharForLetter(char Letter) { /// whether trigraphs are enabled or not. static char DecodeTrigraphChar(const char *CP, Lexer *L) { char Res = GetTrigraphCharForLetter(*CP); - if (Res && L) { - if (!L->getFeatures().Trigraphs) { - L->Diag(CP-2, diag::trigraph_ignored); - return 0; - } else { - L->Diag(CP-2, diag::trigraph_converted, std::string()+Res); - } + if (!Res || !L) return Res; + + if (!L->getFeatures().Trigraphs) { + L->Diag(CP-2, diag::trigraph_ignored); + return 0; } + + L->Diag(CP-2, diag::trigraph_converted) << std::string()+Res; return Res; } |