diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-22 23:50:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-22 23:50:56 +0000 |
commit | 306d892076c831131ebe47125b1dfe41f736e1b0 (patch) | |
tree | f6cbaae79943965a27b80f55cecf03b3a6d81ec9 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 1fd051bfe8f4013f1bd973b28fd2b3f23ad7b7a5 (diff) | |
download | bcm5719-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.cpp | 14 |
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(); |