]> granicus.if.org Git - clang/commitdiff
remove a sneaky version of Diag hiding in PreprocessorLexer.
authorChris Lattner <sabre@nondot.org>
Sat, 22 Nov 2008 06:20:42 +0000 (06:20 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 22 Nov 2008 06:20:42 +0000 (06:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59858 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/Lexer.h
include/clang/Lex/PreprocessorLexer.h
lib/Lex/Lexer.cpp
lib/Lex/PreprocessorLexer.cpp

index 77399e6d56abeed392f29510db726755d46a6692..ac32f5cf79b6da684bf3f2bc7ce0d18d4c450f03 100644 (file)
@@ -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.
index 6275e01328e2f638d63f2997314667e9a0912f2f..1bf60bbdbe8a4824fee34f6a3b3b91bd584b93ea 100644 (file)
@@ -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.
   
index 30875695899f05ab59fd48f1d7fbc38ae2da0d1e..cef848f073e404d35b2c96cc08ffccb32ab1e293 100644 (file)
@@ -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();
   }
   
index 6e479625e0fde38ed13d5f139fa44f3a4c5daff8..5b3538a45b1466df0ac668a1632d02d202978a88 100644 (file)
@@ -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);
 }