[cfe-commits] r86335 - in /cfe/trunk: include/clang/Frontend/InitPreprocessor.h include/clang/Frontend/PreprocessorOptions.h include/clang/Frontend/Utils.h lib/Frontend/InitPreprocessor.cpp tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Fri Nov 6 20:20:15 PST 2009


Author: ddunbar
Date: Fri Nov  6 22:20:15 2009
New Revision: 86335

URL: http://llvm.org/viewvc/llvm-project?rev=86335&view=rev
Log:
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
filenames.

Also, move InitializePreprocessor to Utils.h.

Added:
    cfe/trunk/include/clang/Frontend/PreprocessorOptions.h
      - copied, changed from r86334, cfe/trunk/include/clang/Frontend/InitPreprocessor.h
Removed:
    cfe/trunk/include/clang/Frontend/InitPreprocessor.h
Modified:
    cfe/trunk/include/clang/Frontend/Utils.h
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Removed: cfe/trunk/include/clang/Frontend/InitPreprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/InitPreprocessor.h?rev=86334&view=auto

==============================================================================
--- cfe/trunk/include/clang/Frontend/InitPreprocessor.h (original)
+++ cfe/trunk/include/clang/Frontend/InitPreprocessor.h (removed)
@@ -1,79 +0,0 @@
-//===--- InitPreprocessor.h - InitializePreprocessor function. --*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the clang::InitializePreprocessor function.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_
-#define LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_
-
-#include <string>
-#include <vector>
-
-namespace clang {
-
-class Preprocessor;
-class LangOptions;
-
-/// PreprocessorInitOptions - This class is used for passing the various
-/// options used in preprocessor initialization to InitializePreprocessor().
-class PreprocessorInitOptions {
-  std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
-  std::vector<std::pair<std::string, bool/*isPTH*/> > Includes;
-  std::vector<std::string> MacroIncludes;
-
-  unsigned UsePredefines : 1; /// Initialize the preprocessor with the compiler
-                              /// and target specific predefines.
-
-public:
-  PreprocessorInitOptions() : UsePredefines(true) {}
-
-  bool getUsePredefines() const { return UsePredefines; }
-  void setUsePredefines(bool Value) {
-    UsePredefines = Value;
-  }
-
-  void addMacroDef(const std::string &Name) {
-    Macros.push_back(std::make_pair(Name, false));
-  }
-  void addMacroUndef(const std::string &Name) {
-    Macros.push_back(std::make_pair(Name, true));
-  }
-  void addInclude(const std::string &Name, bool isPTH = false) {
-    Includes.push_back(std::make_pair(Name, isPTH));
-  }
-  void addMacroInclude(const std::string &Name) {
-    MacroIncludes.push_back(Name);
-  }
-
-  typedef std::vector<std::pair<std::string,
-                                bool> >::const_iterator macro_iterator;
-  macro_iterator macro_begin() const { return Macros.begin(); }
-  macro_iterator macro_end() const { return Macros.end(); }
-
-  typedef std::vector<std::pair<std::string,
-                                bool> >::const_iterator include_iterator;
-  include_iterator include_begin() const { return Includes.begin(); }
-  include_iterator include_end() const { return Includes.end(); }
-
-  typedef std::vector<std::string>::const_iterator imacro_iterator;
-  imacro_iterator imacro_begin() const { return MacroIncludes.begin(); }
-  imacro_iterator imacro_end() const { return MacroIncludes.end(); }
-};
-
-/// InitializePreprocessor - Initialize the preprocessor getting it and the
-/// environment ready to process a single file.
-///
-void InitializePreprocessor(Preprocessor &PP,
-                            const PreprocessorInitOptions& InitOptions);
-
-} // end namespace clang
-
-#endif

Copied: cfe/trunk/include/clang/Frontend/PreprocessorOptions.h (from r86334, cfe/trunk/include/clang/Frontend/InitPreprocessor.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PreprocessorOptions.h?p2=cfe/trunk/include/clang/Frontend/PreprocessorOptions.h&p1=cfe/trunk/include/clang/Frontend/InitPreprocessor.h&r1=86334&r2=86335&rev=86335&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/InitPreprocessor.h (original)
+++ cfe/trunk/include/clang/Frontend/PreprocessorOptions.h Fri Nov  6 22:20:15 2009
@@ -1,4 +1,4 @@
-//===--- InitPreprocessor.h - InitializePreprocessor function. --*- C++ -*-===//
+//===--- PreprocessorOptionms.h ---------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -6,13 +6,9 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
-// This file defines the clang::InitializePreprocessor function.
-//
-//===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_
-#define LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_
+#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
+#define LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
 
 #include <string>
 #include <vector>
@@ -22,9 +18,9 @@
 class Preprocessor;
 class LangOptions;
 
-/// PreprocessorInitOptions - This class is used for passing the various
-/// options used in preprocessor initialization to InitializePreprocessor().
-class PreprocessorInitOptions {
+/// PreprocessorOptions - This class is used for passing the various options
+/// used in preprocessor initialization to InitializePreprocessor().
+class PreprocessorOptions {
   std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
   std::vector<std::pair<std::string, bool/*isPTH*/> > Includes;
   std::vector<std::string> MacroIncludes;
@@ -33,7 +29,7 @@
                               /// and target specific predefines.
 
 public:
-  PreprocessorInitOptions() : UsePredefines(true) {}
+  PreprocessorOptions() : UsePredefines(true) {}
 
   bool getUsePredefines() const { return UsePredefines; }
   void setUsePredefines(bool Value) {
@@ -68,12 +64,6 @@
   imacro_iterator imacro_end() const { return MacroIncludes.end(); }
 };
 
-/// InitializePreprocessor - Initialize the preprocessor getting it and the
-/// environment ready to process a single file.
-///
-void InitializePreprocessor(Preprocessor &PP,
-                            const PreprocessorInitOptions& InitOptions);
-
 } // end namespace clang
 
 #endif

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

==============================================================================
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Fri Nov  6 22:20:15 2009
@@ -23,16 +23,23 @@
 }
 
 namespace clang {
-class Preprocessor;
-class MinimalAction;
-class TargetInfo;
-class Diagnostic;
 class ASTConsumer;
+class Decl;
+class Diagnostic;
 class IdentifierTable;
-class SourceManager;
 class LangOptions;
-class Decl;
+class MinimalAction;
+class Preprocessor;
+class PreprocessorOptions;
+class SourceManager;
 class Stmt;
+class TargetInfo;
+
+/// InitializePreprocessor - Initialize the preprocessor getting it and the
+/// environment ready to process a single file.
+///
+void InitializePreprocessor(Preprocessor &PP,
+                            const PreprocessorOptions &PPOpts);
 
 /// ProcessWarningOptions - Initialize the diagnostic client and process the
 /// warning options specified on the command line.

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=86335&r1=86334&r2=86335&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Fri Nov  6 22:20:15 2009
@@ -11,8 +11,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Frontend/InitPreprocessor.h"
+#include "clang/Frontend/Utils.h"
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Frontend/PreprocessorOptions.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
@@ -455,7 +456,7 @@
 /// environment ready to process a single file. This returns true on error.
 ///
 void clang::InitializePreprocessor(Preprocessor &PP,
-                                   const PreprocessorInitOptions &InitOpts) {
+                                   const PreprocessorOptions &InitOpts) {
   std::vector<char> PredefineBuffer;
 
   const char *LineDirective = "# 1 \"<built-in>\" 3\n";
@@ -474,7 +475,7 @@
                          LineDirective, LineDirective+strlen(LineDirective));
 
   // Process #define's and #undef's in the order they are given.
-  for (PreprocessorInitOptions::macro_iterator I = InitOpts.macro_begin(),
+  for (PreprocessorOptions::macro_iterator I = InitOpts.macro_begin(),
        E = InitOpts.macro_end(); I != E; ++I) {
     if (I->second)  // isUndef
       UndefineBuiltinMacro(PredefineBuffer, I->first.c_str());
@@ -484,12 +485,12 @@
 
   // If -imacros are specified, include them now.  These are processed before
   // any -include directives.
-  for (PreprocessorInitOptions::imacro_iterator I = InitOpts.imacro_begin(),
+  for (PreprocessorOptions::imacro_iterator I = InitOpts.imacro_begin(),
        E = InitOpts.imacro_end(); I != E; ++I)
     AddImplicitIncludeMacros(PredefineBuffer, *I);
 
   // Process -include directives.
-  for (PreprocessorInitOptions::include_iterator I = InitOpts.include_begin(),
+  for (PreprocessorOptions::include_iterator I = InitOpts.include_begin(),
        E = InitOpts.include_end(); I != E; ++I) {
     if (I->second) // isPTH
       AddImplicitIncludePTH(PredefineBuffer, PP, I->first);

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=86335&r1=86334&r2=86335&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Fri Nov  6 22:20:15 2009
@@ -30,9 +30,9 @@
 #include "clang/Frontend/FixItRewriter.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/InitHeaderSearch.h"
-#include "clang/Frontend/InitPreprocessor.h"
-#include "clang/Frontend/PathDiagnosticClients.h"
 #include "clang/Frontend/PCHReader.h"
+#include "clang/Frontend/PathDiagnosticClients.h"
+#include "clang/Frontend/PreprocessorOptions.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Frontend/CommandLineSourceLoc.h"
@@ -1171,7 +1171,7 @@
   Init.Realize();
 }
 
-void InitializePreprocessorInitOptions(PreprocessorInitOptions &InitOpts) {
+void InitializePreprocessorOptions(PreprocessorOptions &InitOpts) {
   // Use predefines?
   InitOpts.setUsePredefines(!UndefMacros);
 
@@ -1270,8 +1270,8 @@
     PP->setPTHManager(PTHMgr);
   }
 
-  PreprocessorInitOptions InitOpts;
-  InitializePreprocessorInitOptions(InitOpts);
+  PreprocessorOptions InitOpts;
+  InitializePreprocessorOptions(InitOpts);
   InitializePreprocessor(*PP, InitOpts);
 
   return PP;





More information about the cfe-commits mailing list