From 57dab26be1a1e180963b51c631e655d022f14413 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 22 Nov 2008 06:20:42 +0000 Subject: remove a sneaky version of Diag hiding in PreprocessorLexer. llvm-svn: 59858 --- clang/include/clang/Lex/Lexer.h | 1 + clang/include/clang/Lex/PreprocessorLexer.h | 5 ----- clang/lib/Lex/Lexer.cpp | 9 ++++++--- clang/lib/Lex/PreprocessorLexer.cpp | 8 +------- 4 files changed, 8 insertions(+), 15 deletions(-) (limited to 'clang') diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h index 77399e6d56a..ac32f5cf79b 100644 --- a/clang/include/clang/Lex/Lexer.h +++ b/clang/include/clang/Lex/Lexer.h @@ -173,6 +173,7 @@ public: /// Diag - Forwarding function for diagnostics. This translate a source /// position in the current buffer into a SourceLocation object for rendering. DiagnosticBuilder Diag(const char *Loc, unsigned DiagID) const; + DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const; /// getSourceLocation - Return a source location identifier for the specified /// offset in the current file. diff --git a/clang/include/clang/Lex/PreprocessorLexer.h b/clang/include/clang/Lex/PreprocessorLexer.h index 6275e01328e..1bf60bbdbe8 100644 --- a/clang/include/clang/Lex/PreprocessorLexer.h +++ b/clang/include/clang/Lex/PreprocessorLexer.h @@ -79,11 +79,6 @@ protected: virtual void IndirectLex(Token& Result) = 0; - /// Diag - Forwarding function for diagnostics. This translate a source - /// position in the current buffer into a SourceLocation object for rendering. - void Diag(SourceLocation Loc, unsigned DiagID, - const std::string &Msg = std::string()) const; - //===--------------------------------------------------------------------===// // #if directive handling. diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 30875695899..cef848f073e 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -313,6 +313,11 @@ DiagnosticBuilder Lexer::Diag(const char *Loc, unsigned DiagID) const { return PP->Diag(getSourceLocation(Loc), DiagID); } +DiagnosticBuilder Lexer::Diag(SourceLocation Loc, unsigned DiagID) const { + return PP->Diag(Loc, DiagID); +} + + //===----------------------------------------------------------------------===// // Trigraph and Escaped Newline Handling Code. //===----------------------------------------------------------------------===// @@ -1148,9 +1153,7 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { // If we are in a #if directive, emit an error. while (!ConditionalStack.empty()) { - PreprocessorLexer::Diag(ConditionalStack.back().IfLoc, - diag::err_pp_unterminated_conditional); - + Diag(ConditionalStack.back().IfLoc, diag::err_pp_unterminated_conditional); ConditionalStack.pop_back(); } diff --git a/clang/lib/Lex/PreprocessorLexer.cpp b/clang/lib/Lex/PreprocessorLexer.cpp index 6e479625e0f..5b3538a45b1 100644 --- a/clang/lib/Lex/PreprocessorLexer.cpp +++ b/clang/lib/Lex/PreprocessorLexer.cpp @@ -15,7 +15,6 @@ #include "clang/Lex/Preprocessor.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" - using namespace clang; PreprocessorLexer::PreprocessorLexer(Preprocessor* pp, SourceLocation L) @@ -26,11 +25,6 @@ PreprocessorLexer::PreprocessorLexer(Preprocessor* pp, SourceLocation L) PreprocessorLexer::~PreprocessorLexer() {} -void PreprocessorLexer::Diag(SourceLocation Loc, unsigned DiagID, - const std::string &Msg) const { - PP->Diag(Loc, DiagID) << Msg; -} - /// LexIncludeFilename - After the preprocessor has parsed a #include, lex and /// (potentially) macro expand the filename. void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) { @@ -49,5 +43,5 @@ void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) { // No filename? if (FilenameTok.is(tok::eom)) - Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename); + PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename); } -- cgit v1.2.3