[cfe-commits] r59858 - in /cfe/trunk: include/clang/Lex/Lexer.h include/clang/Lex/PreprocessorLexer.h lib/Lex/Lexer.cpp lib/Lex/PreprocessorLexer.cpp

Chris Lattner sabre at nondot.org
Fri Nov 21 22:20:43 PST 2008


Author: lattner
Date: Sat Nov 22 00:20:42 2008
New Revision: 59858

URL: http://llvm.org/viewvc/llvm-project?rev=59858&view=rev
Log:
remove a sneaky version of Diag hiding in PreprocessorLexer.

Modified:
    cfe/trunk/include/clang/Lex/Lexer.h
    cfe/trunk/include/clang/Lex/PreprocessorLexer.h
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/lib/Lex/PreprocessorLexer.cpp

Modified: cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=59858&r1=59857&r2=59858&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/trunk/include/clang/Lex/Lexer.h Sat Nov 22 00:20:42 2008
@@ -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.

Modified: cfe/trunk/include/clang/Lex/PreprocessorLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessorLexer.h?rev=59858&r1=59857&r2=59858&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/PreprocessorLexer.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessorLexer.h Sat Nov 22 00:20:42 2008
@@ -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.
   

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=59858&r1=59857&r2=59858&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Sat Nov 22 00:20:42 2008
@@ -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();
   }
   

Modified: cfe/trunk/lib/Lex/PreprocessorLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PreprocessorLexer.cpp?rev=59858&r1=59857&r2=59858&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PreprocessorLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PreprocessorLexer.cpp Sat Nov 22 00:20:42 2008
@@ -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);
 }





More information about the cfe-commits mailing list