Introduce a PCHContainerOperations interface (NFC).
A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
This commit is contained in:
@@ -97,10 +97,11 @@ static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP,
|
||||
/// \brief Add an implicit \#include using the original file used to generate
|
||||
/// a PCH file.
|
||||
static void AddImplicitIncludePCH(MacroBuilder &Builder, Preprocessor &PP,
|
||||
const PCHContainerOperations &PCHContainerOps,
|
||||
StringRef ImplicitIncludePCH) {
|
||||
std::string OriginalFile =
|
||||
ASTReader::getOriginalSourceFile(ImplicitIncludePCH, PP.getFileManager(),
|
||||
PP.getDiagnostics());
|
||||
ASTReader::getOriginalSourceFile(ImplicitIncludePCH, PP.getFileManager(),
|
||||
PCHContainerOps, PP.getDiagnostics());
|
||||
if (OriginalFile.empty())
|
||||
return;
|
||||
|
||||
@@ -891,9 +892,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
||||
/// InitializePreprocessor - Initialize the preprocessor getting it and the
|
||||
/// environment ready to process a single file. This returns true on error.
|
||||
///
|
||||
void clang::InitializePreprocessor(Preprocessor &PP,
|
||||
const PreprocessorOptions &InitOpts,
|
||||
const FrontendOptions &FEOpts) {
|
||||
void clang::InitializePreprocessor(
|
||||
Preprocessor &PP, const PreprocessorOptions &InitOpts,
|
||||
const PCHContainerOperations &PCHContainerOps,
|
||||
const FrontendOptions &FEOpts) {
|
||||
const LangOptions &LangOpts = PP.getLangOpts();
|
||||
std::string PredefineBuffer;
|
||||
PredefineBuffer.reserve(4080);
|
||||
@@ -952,7 +954,8 @@ void clang::InitializePreprocessor(Preprocessor &PP,
|
||||
|
||||
// Process -include-pch/-include-pth directives.
|
||||
if (!InitOpts.ImplicitPCHInclude.empty())
|
||||
AddImplicitIncludePCH(Builder, PP, InitOpts.ImplicitPCHInclude);
|
||||
AddImplicitIncludePCH(Builder, PP, PCHContainerOps,
|
||||
InitOpts.ImplicitPCHInclude);
|
||||
if (!InitOpts.ImplicitPTHInclude.empty())
|
||||
AddImplicitIncludePTH(Builder, PP, InitOpts.ImplicitPTHInclude);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user