forked from OSchip/llvm-project
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
filenames. Also, move InitializePreprocessor to Utils.h. llvm-svn: 86335
This commit is contained in:
parent
b10ac0d708
commit
00f8a397c6
|
@ -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
|
|
@ -23,16 +23,23 @@ class raw_fd_ostream;
|
|||
}
|
||||
|
||||
namespace clang {
|
||||
class Preprocessor;
|
||||
class MinimalAction;
|
||||
class TargetInfo;
|
||||
class Diagnostic;
|
||||
class ASTConsumer;
|
||||
class IdentifierTable;
|
||||
class SourceManager;
|
||||
class LangOptions;
|
||||
class Decl;
|
||||
class Diagnostic;
|
||||
class IdentifierTable;
|
||||
class LangOptions;
|
||||
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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue