[cfe-commits] r45060 - in /cfe/trunk/Driver: PrintPreprocessedOutput.cpp clang.cpp clang.h

Chris Lattner sabre at nondot.org
Sat Dec 15 12:48:40 PST 2007


Author: lattner
Date: Sat Dec 15 14:48:40 2007
New Revision: 45060

URL: http://llvm.org/viewvc/llvm-project?rev=45060&view=rev
Log:
simplify the interfaces to ProcessInputFile and InitializePreprocessor

Modified:
    cfe/trunk/Driver/PrintPreprocessedOutput.cpp
    cfe/trunk/Driver/clang.cpp
    cfe/trunk/Driver/clang.h

Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=45060&r1=45059&r2=45060&view=diff

==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Sat Dec 15 14:48:40 2007
@@ -531,8 +531,7 @@
 
 /// DoPrintPreprocessedInput - This implements -E mode.
 ///
-void clang::DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
-                                     const LangOptions &Options) {
+void clang::DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP) {
   // Inform the preprocessor whether we want it to retain comments or not, due
   // to -C or -CC.
   PP.SetCommentRetentionState(EnableCommentOutput, EnableMacroCommentOutput);

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=45060&r1=45059&r2=45060&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sat Dec 15 14:48:40 2007
@@ -507,15 +507,13 @@
 ///
 static unsigned InitializePreprocessor(Preprocessor &PP,
                                        const std::string &InFile,
-                                       SourceManager &SourceMgr,
-                                       HeaderSearch &HeaderInfo,
-                                       const LangOptions &LangInfo,
                                        std::vector<char> &PredefineBuffer) {
   
-  FileManager &FileMgr = HeaderInfo.getFileMgr();
+  FileManager &FileMgr = PP.getFileManager();
   
   // Figure out where to get and map in the main file.
   unsigned MainFileID = 0;
+  SourceManager &SourceMgr = PP.getSourceManager();
   if (InFile != "-") {
     const FileEntry *File = FileMgr.getFile(InFile);
     if (File) MainFileID = SourceMgr.createFileID(File, SourceLocation());
@@ -879,10 +877,7 @@
 ///
 static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
                              const std::string &InFile,
-                             SourceManager &SourceMgr,
-                             TextDiagnostics &OurDiagnosticClient,
-                             HeaderSearch &HeaderInfo,
-                             const LangOptions &LangInfo) {
+                             TextDiagnostics &OurDiagnosticClient) {
 
   ASTConsumer* Consumer = NULL;
   bool ClearSourceMgr = false;
@@ -890,7 +885,7 @@
   switch (ProgAction) {
   default:
     Consumer = CreateASTConsumer(InFile, PP.getDiagnostics(),
-                                 HeaderInfo.getFileMgr(),
+                                 PP.getFileManager(),
                                  PP.getLangOptions());
     
     if (!Consumer) {      
@@ -923,7 +918,7 @@
   }
     
   case PrintPreprocessedInput:       // -E mode.
-    DoPrintPreprocessedInput(MainFileID, PP, LangInfo);
+    DoPrintPreprocessedInput(MainFileID, PP);
     ClearSourceMgr = true;
     break;
     
@@ -955,18 +950,17 @@
     fprintf(stderr, "\nSTATISTICS FOR '%s':\n", InFile.c_str());
     PP.PrintStats();
     PP.getIdentifierTable().PrintStats();
-    HeaderInfo.PrintStats();
+    PP.getHeaderSearchInfo().PrintStats();
     if (ClearSourceMgr)
-      SourceMgr.PrintStats();
+      PP.getSourceManager().PrintStats();
     fprintf(stderr, "\n");
   }
 
   // For a multi-file compilation, some things are ok with nuking the source 
   // manager tables, other require stable fileid/macroid's across multiple
   // files.
-  if (ClearSourceMgr) {
-    SourceMgr.clearIDTables();
-  }
+  if (ClearSourceMgr)
+    PP.getSourceManager().clearIDTables();
 }
 
 static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag,
@@ -1112,14 +1106,11 @@
       Preprocessor PP(Diags, LangInfo, *Target, SourceMgr, HeaderInfo);
       
       std::vector<char> PredefineBuffer;
-      unsigned MainFileID = InitializePreprocessor(PP, InFile, SourceMgr,
-                                                   HeaderInfo, LangInfo,
-                                                   PredefineBuffer);
+      unsigned MainFileID = InitializePreprocessor(PP, InFile, PredefineBuffer);
       
       if (!MainFileID) continue;
 
-      ProcessInputFile(PP, MainFileID, InFile, SourceMgr,
-                       *DiagClient, HeaderInfo, LangInfo);
+      ProcessInputFile(PP, MainFileID, InFile, *DiagClient);
       
       HeaderInfo.ClearFileInfo();
       

Modified: cfe/trunk/Driver/clang.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.h?rev=45060&r1=45059&r2=45060&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.h (original)
+++ cfe/trunk/Driver/clang.h Sat Dec 15 14:48:40 2007
@@ -19,7 +19,6 @@
 
 namespace clang {
 class Preprocessor;
-struct LangOptions;
 class MinimalAction;
 class TargetInfo;
 class Diagnostic;
@@ -28,8 +27,7 @@
 class SourceManager;
 
 /// DoPrintPreprocessedInput - Implement -E mode.
-void DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
-                              const LangOptions &Options);
+void DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP);
 
 /// CreatePrintParserActionsAction - Return the actions implementation that
 /// implements the -parse-print-callbacks option.





More information about the cfe-commits mailing list