From 306fda76b0818eb7c215094123f2e16729a44aed Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 22 Nov 2008 06:20:42 +0000 Subject: [PATCH] remove a sneaky version of Diag hiding in PreprocessorLexer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59858 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Lex/Lexer.h | 1 + include/clang/Lex/PreprocessorLexer.h | 5 ----- lib/Lex/Lexer.cpp | 9 ++++++--- lib/Lex/PreprocessorLexer.cpp | 8 +------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index 77399e6d56..ac32f5cf79 100644 --- a/include/clang/Lex/Lexer.h +++ b/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/include/clang/Lex/PreprocessorLexer.h b/include/clang/Lex/PreprocessorLexer.h index 6275e01328..1bf60bbdbe 100644 --- a/include/clang/Lex/PreprocessorLexer.h +++ b/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/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 3087569589..cef848f073 100644 --- a/lib/Lex/Lexer.cpp +++ b/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/lib/Lex/PreprocessorLexer.cpp b/lib/Lex/PreprocessorLexer.cpp index 6e479625e0..5b3538a45b 100644 --- a/lib/Lex/PreprocessorLexer.cpp +++ b/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); } -- 2.40.0