aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.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/Basic/Module.cpp
parent1fd051bfe8f4013f1bd973b28fd2b3f23ad7b7a5 (diff)
downloadllvm-306d892076c831131ebe47125b1dfe41f736e1b0.zip
llvm-306d892076c831131ebe47125b1dfe41f736e1b0.tar.gz
llvm-306d892076c831131ebe47125b1dfe41f736e1b0.tar.bz2
[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/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 65c8b1b..c0f5a6a 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -338,27 +338,23 @@ void Module::print(raw_ostream &OS, unsigned Indent) const {
OS << "\n";
}
- for (unsigned I = 0, N = NormalHeaders.size(); I != N; ++I) {
- OS.indent(Indent + 2);
- OS << "header \"";
- OS.write_escaped(NormalHeaders[I]->getName());
- OS << "\"\n";
- }
-
- for (unsigned I = 0, N = ExcludedHeaders.size(); I != N; ++I) {
- OS.indent(Indent + 2);
- OS << "exclude header \"";
- OS.write_escaped(ExcludedHeaders[I]->getName());
- OS << "\"\n";
+ struct HeaderKind {
+ StringRef Prefix;
+ const SmallVectorImpl<const FileEntry *> &Headers;
+ } Kinds[] = {{"", NormalHeaders},
+ {"exclude ", ExcludedHeaders},
+ {"textual ", TextualHeaders},
+ {"private ", PrivateHeaders}};
+
+ for (auto &K : Kinds) {
+ for (auto *H : K.Headers) {
+ OS.indent(Indent + 2);
+ OS << K.Prefix << "header \"";
+ OS.write_escaped(H->getName());
+ OS << "\"\n";
+ }
}
- for (unsigned I = 0, N = PrivateHeaders.size(); I != N; ++I) {
- OS.indent(Indent + 2);
- OS << "private header \"";
- OS.write_escaped(PrivateHeaders[I]->getName());
- OS << "\"\n";
- }
-
for (submodule_const_iterator MI = submodule_begin(), MIEnd = submodule_end();
MI != MIEnd; ++MI)
// Print inferred subframework modules so that we don't need to re-infer