summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-12-02 00:08:08 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-12-02 00:08:08 +0000
commit3c1a41ad9969ae4e3353f5984d66af85ce56cf9a (patch)
treef19e3452dbc34c152accbcee5057286a353da704 /clang/lib/Basic/Module.cpp
parent4cdf4eba74df1c2a679931716fc630fd484bdb3c (diff)
downloadbcm5719-llvm-3c1a41ad9969ae4e3353f5984d66af85ce56cf9a.tar.gz
bcm5719-llvm-3c1a41ad9969ae4e3353f5984d66af85ce56cf9a.zip
[modules] Track how 'header' directives were written in module map files,
rather than trying to extract this information from the FileEntry after the fact. This has a number of beneficial effects. For instance, diagnostic messages for failed module builds give a path relative to the "module root" rather than an absolute file path, and the contents of the module includes file is no longer dependent on what files the including TU happened to inspect prior to triggering the module build. llvm-svn: 223095
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index c0f5a6afa10..ba3526c334f 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -26,7 +26,7 @@ using namespace clang;
Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
bool IsFramework, bool IsExplicit)
- : Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent),
+ : Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent), Directory(),
Umbrella(), ASTFile(nullptr), IsMissingRequirement(false),
IsAvailable(true), IsFromModuleFile(false), IsFramework(IsFramework),
IsExplicit(IsExplicit), IsSystem(false), IsExternC(false),
@@ -70,9 +70,9 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
.Default(Target.hasFeature(Feature));
}
-bool
-Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
- Requirement &Req, HeaderDirective &MissingHeader) const {
+bool Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
+ Requirement &Req,
+ UnresolvedHeaderDirective &MissingHeader) const {
if (IsAvailable)
return true;
@@ -338,19 +338,20 @@ void Module::print(raw_ostream &OS, unsigned Indent) const {
OS << "\n";
}
- struct HeaderKind {
+ struct {
StringRef Prefix;
- const SmallVectorImpl<const FileEntry *> &Headers;
- } Kinds[] = {{"", NormalHeaders},
- {"exclude ", ExcludedHeaders},
- {"textual ", TextualHeaders},
- {"private ", PrivateHeaders}};
+ HeaderKind Kind;
+ } Kinds[] = {{"", HK_Normal},
+ {"textual ", HK_Textual},
+ {"private ", HK_Private},
+ {"private textual ", HK_PrivateTextual},
+ {"exclude ", HK_Excluded}};
for (auto &K : Kinds) {
- for (auto *H : K.Headers) {
+ for (auto &H : Headers[K.Kind]) {
OS.indent(Indent + 2);
OS << K.Prefix << "header \"";
- OS.write_escaped(H->getName());
+ OS.write_escaped(H.NameAsWritten);
OS << "\"\n";
}
}
OpenPOWER on IntegriCloud