Make the clang module container format selectable from the command line.

- introduces a new cc1 option -fmodule-format=[raw,obj]
  with 'raw' being the default
- supports arbitrary module container formats that libclang is agnostic to
- adds the format to the module hash to avoid collisions
- splits the old PCHContainerOperations into PCHContainerWriter and
  a PCHContainerReader.

Thanks to Richard Smith for reviewing this patch!

llvm-svn: 242499
This commit is contained in:
Adrian Prantl
2015-07-17 01:19:54 +00:00
parent cabe02e141
commit fb2398d0c4
38 changed files with 240 additions and 140 deletions

View File

@@ -156,7 +156,7 @@ public:
} // namespace
std::unique_ptr<ASTConsumer>
ObjectFilePCHContainerOperations::CreatePCHContainerGenerator(
ObjectFilePCHContainerWriter::CreatePCHContainerGenerator(
DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO, const TargetOptions &TO,
const LangOptions &LO, const std::string &MainFileName,
@@ -166,7 +166,7 @@ ObjectFilePCHContainerOperations::CreatePCHContainerGenerator(
Diags, HSO, PPO, TO, LO, MainFileName, OutputFileName, OS, Buffer);
}
void ObjectFilePCHContainerOperations::ExtractPCH(
void ObjectFilePCHContainerReader::ExtractPCH(
llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const {
if (auto OF = llvm::object::ObjectFile::createObjectFile(Buffer)) {
auto *Obj = OF.get().get();