]> granicus.if.org Git - clang/commitdiff
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
authorDaniel Dunbar <daniel@zuster.org>
Sat, 7 Nov 2009 04:20:15 +0000 (04:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 7 Nov 2009 04:20:15 +0000 (04:20 +0000)
filenames.

Also, move InitializePreprocessor to Utils.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86335 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/PreprocessorOptions.h [moved from include/clang/Frontend/InitPreprocessor.h with 71% similarity]
include/clang/Frontend/Utils.h
lib/Frontend/InitPreprocessor.cpp
tools/clang-cc/clang-cc.cpp

similarity index 71%
rename from include/clang/Frontend/InitPreprocessor.h
rename to include/clang/Frontend/PreprocessorOptions.h
index 415acea79a26c95d09f65a1019c3bdee3fed83bd..cae37e78f57b3fcf7149cb05bddd8903b2b1a10c 100644 (file)
@@ -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 @@ namespace clang {
 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 @@ class PreprocessorInitOptions {
                               /// and target specific predefines.
 
 public:
-  PreprocessorInitOptions() : UsePredefines(true) {}
+  PreprocessorOptions() : UsePredefines(true) {}
 
   bool getUsePredefines() const { return UsePredefines; }
   void setUsePredefines(bool Value) {
@@ -68,12 +64,6 @@ public:
   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
index 3c670286545ba4a2c9edf96e9456faba3916ffa8..480e46ab72183fcc741a1f8b682d9ec7587a5897 100644 (file)
@@ -23,16 +23,23 @@ class raw_fd_ostream;
 }
 
 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.
index b4b31c359f53837da2b7676b352ccc805416a203..75e475aa37fd6ca5926180a3cc0b16e676ce72fe 100644 (file)
@@ -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 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
 /// 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 @@ void clang::InitializePreprocessor(Preprocessor &PP,
                          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 @@ void clang::InitializePreprocessor(Preprocessor &PP,
 
   // 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);
index 9b6475a46dade9c69a6821d88cb95cae285dc11e..168a840332977a9a5bb63fef44252b02bb19cb6c 100644 (file)
@@ -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 @@ void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers,
   Init.Realize();
 }
 
-void InitializePreprocessorInitOptions(PreprocessorInitOptions &InitOpts) {
+void InitializePreprocessorOptions(PreprocessorOptions &InitOpts) {
   // Use predefines?
   InitOpts.setUsePredefines(!UndefMacros);
 
@@ -1270,8 +1270,8 @@ CreatePreprocessor(Diagnostic &Diags,const LangOptions &LangInfo,
     PP->setPTHManager(PTHMgr);
   }
 
-  PreprocessorInitOptions InitOpts;
-  InitializePreprocessorInitOptions(InitOpts);
+  PreprocessorOptions InitOpts;
+  InitializePreprocessorOptions(InitOpts);
   InitializePreprocessor(*PP, InitOpts);
 
   return PP;