diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-31 04:05:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-31 04:05:44 +0000 |
commit | 1fb5c3a63a88e4758b196f1bda64eecce9b29d3f (patch) | |
tree | 0da4770b525e3b6a77a4b54bd828262d2bda7dfa /clang/lib/Serialization/ASTReader.cpp | |
parent | 84a5dfdf727df09432aaa40ac72aa94e500326e4 (diff) | |
download | bcm5719-llvm-1fb5c3a63a88e4758b196f1bda64eecce9b29d3f.tar.gz bcm5719-llvm-1fb5c3a63a88e4758b196f1bda64eecce9b29d3f.zip |
Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).
llvm-svn: 147387
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 440474b587a..dd48b2dc564 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2523,6 +2523,11 @@ void ASTReader::makeModuleVisible(Module *Mod, continue; } + if (!Mod->isAvailable()) { + // Modules that aren't available cannot be made visible. + continue; + } + // Update the module's name visibility. Mod->NameVisibility = NameVisibility; @@ -3247,6 +3252,19 @@ ASTReader::ASTReadResult ASTReader::ReadSubmoduleBlock(ModuleFile &F) { CurrentModule->UnresolvedExports.clear(); break; } + case SUBMODULE_REQUIRES: { + if (First) { + Error("missing submodule metadata record at beginning of block"); + return Failure; + } + + if (!CurrentModule) + break; + + CurrentModule->addRequirement(StringRef(BlobStart, BlobLen), + Context.getLangOptions()); + break; + } } } |