]> granicus.if.org Git - clang/commitdiff
Move PreprocessorOptions into the Lex library, and make it intrusively
authorDouglas Gregor <dgregor@apple.com>
Wed, 24 Oct 2012 17:01:35 +0000 (17:01 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 24 Oct 2012 17:01:35 +0000 (17:01 +0000)
reference-counted.

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

include/clang/Frontend/CompilerInvocation.h
include/clang/Lex/PreprocessorOptions.h [moved from include/clang/Frontend/PreprocessorOptions.h with 97% similarity]
lib/ARCMigrate/FileRemapper.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InitPreprocessor.cpp

index 5509e77a1b8139aebf088589db70cb4cd625dfd5..bd5846b0d6763a24cb95c84284485ff2d415e017 100644 (file)
 #include "clang/Basic/FileSystemOptions.h"
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Lex/HeaderSearchOptions.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/Frontend/MigratorOptions.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
 #include "clang/Frontend/FrontendOptions.h"
 #include "clang/Frontend/LangStandard.h"
-#include "clang/Frontend/PreprocessorOptions.h"
 #include "clang/Frontend/PreprocessorOutputOptions.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
@@ -62,6 +62,9 @@ protected:
   /// Options controlling the \#include directive.
   IntrusiveRefCntPtr<HeaderSearchOptions> HeaderSearchOpts;
 
+  /// Options controlling the preprocessor (aside from \#include handling).
+  IntrusiveRefCntPtr<PreprocessorOptions> PreprocessorOpts;
+
 public:
   CompilerInvocationBase();
 
@@ -81,6 +84,11 @@ public:
   const HeaderSearchOptions &getHeaderSearchOpts() const {
     return *HeaderSearchOpts;
   }
+
+  PreprocessorOptions &getPreprocessorOpts() { return *PreprocessorOpts; }
+  const PreprocessorOptions &getPreprocessorOpts() const {
+    return *PreprocessorOpts;
+  }
 };
   
 /// \brief Helper class for holding the data necessary to invoke the compiler.
@@ -106,9 +114,6 @@ class CompilerInvocation : public CompilerInvocationBase {
   /// Options controlling the frontend itself.
   FrontendOptions FrontendOpts;
 
-  /// Options controlling the preprocessor (aside from \#include handling).
-  PreprocessorOptions PreprocessorOpts;
-
   /// Options controlling preprocessed output.
   PreprocessorOutputOptions PreprocessorOutputOpts;
 
@@ -192,11 +197,6 @@ public:
     return FrontendOpts;
   }
 
-  PreprocessorOptions &getPreprocessorOpts() { return PreprocessorOpts; }
-  const PreprocessorOptions &getPreprocessorOpts() const {
-    return PreprocessorOpts;
-  }
-
   PreprocessorOutputOptions &getPreprocessorOutputOpts() {
     return PreprocessorOutputOpts;
   }
similarity index 97%
rename from include/clang/Frontend/PreprocessorOptions.h
rename to include/clang/Lex/PreprocessorOptions.h
index d86a923d43074d5c8b4fa3fa1630f920a103f8b7..4f323606ee9ad0e58b5d715ba2f8179b0a154aed 100644 (file)
@@ -7,9 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
-#define LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
+#ifndef LLVM_CLANG_LEX_PREPROCESSOROPTIONS_H_
+#define LLVM_CLANG_LEX_PREPROCESSOROPTIONS_H_
 
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <cassert>
@@ -38,7 +39,7 @@ enum ObjCXXARCStandardLibraryKind {
   
 /// PreprocessorOptions - This class is used for passing the various options
 /// used in preprocessor initialization to InitializePreprocessor().
-class PreprocessorOptions {
+class PreprocessorOptions : public llvm::RefCountedBase<PreprocessorOptions> {
 public:
   std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
   std::vector<std::string> Includes;
index e9b49b3039ba4f2d5aed9defd5ecc63b4a51f151..28ca9a56b20e58bacf223ea7600768152c619a1d 100644 (file)
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/ARCMigrate/FileRemapper.h"
-#include "clang/Frontend/PreprocessorOptions.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Support/MemoryBuffer.h"
index b941609318b8f5b7b8bd3cc79b70abd30d0eb9e0..78dc0d5fb04485ac6892da8cda111af660f9fc2d 100644 (file)
@@ -37,14 +37,16 @@ using namespace clang;
 CompilerInvocationBase::CompilerInvocationBase()
   : LangOpts(new LangOptions()), TargetOpts(new TargetOptions()),
     DiagnosticOpts(new DiagnosticOptions()),
-    HeaderSearchOpts(new HeaderSearchOptions()) {}
+    HeaderSearchOpts(new HeaderSearchOptions()),
+    PreprocessorOpts(new PreprocessorOptions()) {}
 
 CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
   : RefCountedBase<CompilerInvocation>(),
     LangOpts(new LangOptions(*X.getLangOpts())), 
     TargetOpts(new TargetOptions(X.getTargetOpts())),
     DiagnosticOpts(new DiagnosticOptions(X.getDiagnosticOpts())),
-    HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())) {}
+    HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())),
+    PreprocessorOpts(new PreprocessorOptions(X.getPreprocessorOpts())) {}
 
 //===----------------------------------------------------------------------===//
 // Utility functions.
index 24e7dcd95cf3ef32104c51ccb8184cc9d30fc367..870337972440aafed507ecfc7f064b80556212ab 100644 (file)
@@ -17,9 +17,9 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/FrontendOptions.h"
-#include "clang/Frontend/PreprocessorOptions.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Serialization/ASTReader.h"