aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-07 04:20:15 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-07 04:20:15 +0000
commit8863b985f1cf78a2fb62913e184dc45162853cf9 (patch)
tree95fb53eec9e1d1dc2e73f8fc5d7c968847694e0f
parent750156aec27f66ddd53bf05bde34f147e73e7769 (diff)
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
filenames. Also, move InitializePreprocessor to Utils.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86335 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Frontend/PreprocessorOptions.h (renamed from include/clang/Frontend/InitPreprocessor.h)24
-rw-r--r--include/clang/Frontend/Utils.h19
-rw-r--r--lib/Frontend/InitPreprocessor.cpp11
-rw-r--r--tools/clang-cc/clang-cc.cpp10
4 files changed, 31 insertions, 33 deletions
diff --git a/include/clang/Frontend/InitPreprocessor.h b/include/clang/Frontend/PreprocessorOptions.h
index 415acea79a..cae37e78f5 100644
--- a/include/clang/Frontend/InitPreprocessor.h
+++ b/include/clang/Frontend/PreprocessorOptions.h
@@ -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
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 3c67028654..480e46ab72 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -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.
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index b4b31c359f..75e475aa37 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -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);
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 9b6475a46d..168a840332 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -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;