summaryrefslogtreecommitdiffstats
path: root/lib/Basic
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
commit180484ac5c8332c78e10da31e6775a70a4c7f11b (patch)
treea2bd9959db8d0fe3225620aff6c9124a32627d95 /lib/Basic
parent81627cd1f5a173f43b41209738cefe51d97db97f (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/Module.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp
index 65c8b1b581..c0f5a6afa1 100644
--- a/lib/Basic/Module.cpp
+++ b/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