summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-10-22 23:50:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-10-22 23:50:56 +0000
commit306d892076c831131ebe47125b1dfe41f736e1b0 (patch)
treef6cbaae79943965a27b80f55cecf03b3a6d81ec9 /clang/lib/Serialization/ASTWriter.cpp
parent1fd051bfe8f4013f1bd973b28fd2b3f23ad7b7a5 (diff)
downloadbcm5719-llvm-306d892076c831131ebe47125b1dfe41f736e1b0.tar.gz
bcm5719-llvm-306d892076c831131ebe47125b1dfe41f736e1b0.zip
[modules] Add support for 'textual header' directives.
This allows a module to specify that it logically contains a file, but that said file is non-modular and intended for textual inclusion. This allows layering checks to work properly in the presence of such files. llvm-svn: 220448
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 474ea279e3e..0681e3975d2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2405,6 +2405,11 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) {
unsigned ExcludedHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
Abbrev = new BitCodeAbbrev();
+ Abbrev->Add(BitCodeAbbrevOp(SUBMODULE_TEXTUAL_HEADER));
+ Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Name
+ unsigned TextualHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
+
+ Abbrev = new BitCodeAbbrev();
Abbrev->Add(BitCodeAbbrevOp(SUBMODULE_PRIVATE_HEADER));
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Name
unsigned PrivateHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
@@ -2481,7 +2486,7 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) {
Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
UmbrellaDir->getName());
}
-
+
// Emit the headers.
for (unsigned I = 0, N = Mod->NormalHeaders.size(); I != N; ++I) {
Record.clear();
@@ -2496,6 +2501,13 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) {
Stream.EmitRecordWithBlob(ExcludedHeaderAbbrev, Record,
Mod->ExcludedHeaders[I]->getName());
}
+ // Emit the textual headers.
+ for (unsigned I = 0, N = Mod->TextualHeaders.size(); I != N; ++I) {
+ Record.clear();
+ Record.push_back(SUBMODULE_TEXTUAL_HEADER);
+ Stream.EmitRecordWithBlob(TextualHeaderAbbrev, Record,
+ Mod->TextualHeaders[I]->getName());
+ }
// Emit the private headers.
for (unsigned I = 0, N = Mod->PrivateHeaders.size(); I != N; ++I) {
Record.clear();
OpenPOWER on IntegriCloud