[cfe-commits] r88744 - in /cfe/trunk: include/clang/Basic/Diagnostic.h include/clang/Frontend/ChainedDiagnosticClient.h include/clang/Frontend/TextDiagnosticPrinter.h tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Fri Nov 13 18:48:04 PST 2009


Author: ddunbar
Date: Fri Nov 13 20:48:04 2009
New Revision: 88744

URL: http://llvm.org/viewvc/llvm-project?rev=88744&view=rev
Log:
Pass Preprocessor through DiagnosticClient::BeginSourceFile.

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h
    cfe/trunk/include/clang/Frontend/ChainedDiagnosticClient.h
    cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=88744&r1=88743&r2=88744&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Nov 13 20:48:04 2009
@@ -32,6 +32,7 @@
   class IdentifierInfo;
   class LangOptions;
   class PartialDiagnostic;
+  class Preprocessor;
   class SourceRange;
 
   // Import the diagnostic enums themselves.
@@ -791,7 +792,8 @@
   /// \arg LO - The language options for the source file being processed.
   /// \arg PP - The preprocessor object being used for the source; this optional
   /// and may not be present, for example when processing AST source files.
-  virtual void BeginSourceFile(const LangOptions &LangOpts) {}
+  virtual void BeginSourceFile(const LangOptions &LangOpts,
+                               const Preprocessor *PP = 0) {}
 
   /// EndSourceFile - Callback to inform the diagnostic client that processing
   /// of a source file has ended. The diagnostic client should assume that any

Modified: cfe/trunk/include/clang/Frontend/ChainedDiagnosticClient.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ChainedDiagnosticClient.h?rev=88744&r1=88743&r2=88744&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/ChainedDiagnosticClient.h (original)
+++ cfe/trunk/include/clang/Frontend/ChainedDiagnosticClient.h Fri Nov 13 20:48:04 2009
@@ -30,9 +30,10 @@
     Secondary.reset(_Secondary);
   }
 
-  virtual void BeginSourceFile(const LangOptions &LO) {
-    Primary->BeginSourceFile(LO);
-    Secondary->BeginSourceFile(LO);
+  virtual void BeginSourceFile(const LangOptions &LO,
+                               const Preprocessor *PP) {
+    Primary->BeginSourceFile(LO, PP);
+    Secondary->BeginSourceFile(LO, PP);
   }
 
   virtual void EndSourceFile() {

Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h?rev=88744&r1=88743&r2=88744&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h Fri Nov 13 20:48:04 2009
@@ -42,7 +42,7 @@
                         bool OwnsOutputStream = false);
   virtual ~TextDiagnosticPrinter();
 
-  void BeginSourceFile(const LangOptions &LO) {
+  void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) {
     LangOpts = &LO;
   }
 

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=88744&r1=88743&r2=88744&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Fri Nov 13 20:48:04 2009
@@ -579,7 +579,7 @@
   AST->getSourceManager().createMainFileIDForMemBuffer(SB);
 
   // Stream the input AST to the consumer.
-  CI.getDiagnostics().getClient()->BeginSourceFile(PP.getLangOptions());
+  CI.getDiagnostics().getClient()->BeginSourceFile(PP.getLangOptions(), &PP);
   ParseAST(PP, Consumer.get(), AST->getASTContext(),
            CI.getFrontendOpts().ShowStats);
   CI.getDiagnostics().getClient()->EndSourceFile();
@@ -767,7 +767,8 @@
     Clang.createPreprocessor();
 
     // Process the source file.
-    Clang.getDiagnostics().getClient()->BeginSourceFile(Clang.getLangOpts());
+    Clang.getDiagnostics().getClient()->BeginSourceFile(Clang.getLangOpts(),
+                                                      &Clang.getPreprocessor());
     ProcessInputFile(Clang, InFile, ProgAction);
     Clang.getDiagnostics().getClient()->EndSourceFile();
   }





More information about the cfe-commits mailing list