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
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index 77399e6..ac32f5c 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -173,6 +173,7 @@
/// 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 6275e01..1bf60bb 100644
--- a/include/clang/Lex/PreprocessorLexer.h
+++ b/include/clang/Lex/PreprocessorLexer.h
@@ -79,11 +79,6 @@
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 3087569..cef848f 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -313,6 +313,11 @@
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 @@
// 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 6e47962..5b3538a 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() {}
-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 @@
// No filename?
if (FilenameTok.is(tok::eom))
- Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
+ PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
}