summaryrefslogtreecommitdiffstats
path: root/clang/tools/driver/cc1_main.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-07-17 01:19:54 +0000
committerAdrian Prantl <aprantl@apple.com>2015-07-17 01:19:54 +0000
commitfb2398d0c43405a6b654c80560e38fb3ccd134b9 (patch)
treee1a0f288169e920a3ac6d9f2aaece67eb7796bf1 /clang/tools/driver/cc1_main.cpp
parentcabe02e14110526189a0935d172f8547f0232572 (diff)
downloadbcm5719-llvm-fb2398d0c43405a6b654c80560e38fb3ccd134b9.tar.gz
bcm5719-llvm-fb2398d0c43405a6b654c80560e38fb3ccd134b9.zip
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
Diffstat (limited to 'clang/tools/driver/cc1_main.cpp')
-rw-r--r--clang/tools/driver/cc1_main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index 65f845ddc45..8240561236b 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/tools/driver/cc1_main.cpp
@@ -65,10 +65,14 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
#endif
int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
- std::unique_ptr<CompilerInstance> Clang(new CompilerInstance(
- std::make_shared<ObjectFilePCHContainerOperations>()));
+ std::unique_ptr<CompilerInstance> Clang(new CompilerInstance());
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+ // Register the support for object-file-wrapped Clang modules.
+ auto PCHOps = Clang->getPCHContainerOperations();
+ PCHOps->registerWriter(llvm::make_unique<ObjectFilePCHContainerWriter>());
+ PCHOps->registerReader(llvm::make_unique<ObjectFilePCHContainerReader>());
+
// Initialize targets first, so that --version shows registered targets.
llvm::InitializeAllTargets();
llvm::InitializeAllTargetMCs();
OpenPOWER on IntegriCloud