summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ChainedIncludesSource.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-11-03 18:33:07 +0000
committerDouglas Gregor <dgregor@apple.com>2015-11-03 18:33:07 +0000
commit6623e1f10f9546cfe68268ca6724a6fc187b3c1d (patch)
tree6cddb8332ff40c4c9e9c6b4a8d1d5b2111d7476f /clang/lib/Frontend/ChainedIncludesSource.cpp
parent63103c92797e8dfb9d879d71a17c7a60c0ab3d90 (diff)
downloadbcm5719-llvm-6623e1f10f9546cfe68268ca6724a6fc187b3c1d.tar.gz
bcm5719-llvm-6623e1f10f9546cfe68268ca6724a6fc187b3c1d.zip
Introduce module file extensions to piggy-back data onto module files.
Introduce the notion of a module file extension, which introduces additional information into a module file at the time it is built that can then be queried when the module file is read. Module file extensions are identified by a block name (which must be unique to the extension) and can write any bitstream records into their own extension block within the module file. When a module file is loaded, any extension blocks are matched up with module file extension readers, that are per-module-file and are given access to the input bitstream. Note that module file extensions can only be introduced by programmatic clients that have access to the CompilerInvocation. There is only one such extension at the moment, which is used for testing the module file extension harness. As a future direction, one could imagine allowing the plugin mechanism to introduce new module file extensions. llvm-svn: 251955
Diffstat (limited to 'clang/lib/Frontend/ChainedIncludesSource.cpp')
-rw-r--r--clang/lib/Frontend/ChainedIncludesSource.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp
index d36162b8dab..1c1081fbe08 100644
--- a/clang/lib/Frontend/ChainedIncludesSource.cpp
+++ b/clang/lib/Frontend/ChainedIncludesSource.cpp
@@ -82,6 +82,7 @@ createASTReader(CompilerInstance &CI, StringRef pchFile,
std::unique_ptr<ASTReader> Reader;
Reader.reset(new ASTReader(PP, CI.getASTContext(),
CI.getPCHContainerReader(),
+ /*Extensions=*/{ },
/*isysroot=*/"", /*DisableValidation=*/true));
for (unsigned ti = 0; ti < bufNames.size(); ++ti) {
StringRef sr(bufNames[ti]);
@@ -160,8 +161,10 @@ IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource(
Clang->createASTContext();
auto Buffer = std::make_shared<PCHBuffer>();
+ ArrayRef<llvm::IntrusiveRefCntPtr<ModuleFileExtension>> Extensions;
auto consumer = llvm::make_unique<PCHGenerator>(
- Clang->getPreprocessor(), "-", nullptr, /*isysroot=*/"", Buffer);
+ Clang->getPreprocessor(), "-", nullptr, /*isysroot=*/"", Buffer,
+ Extensions);
Clang->getASTContext().setASTMutationListener(
consumer->GetASTMutationListener());
Clang->setASTConsumer(std::move(consumer));
OpenPOWER on IntegriCloud