aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-30 16:10:10 -0400
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-02 14:07:23 -0800
commit32c501dd88b62787d3a5ffda7aabcf4650dbe3cd (patch)
tree57b12b968aafed64121a218108c25abc09d408a1 /clang/lib/Basic/Module.cpp
parent327af6aa60bf689713ff7dde42a9caa3a2dd03f8 (diff)
downloadllvm-32c501dd88b62787d3a5ffda7aabcf4650dbe3cd.zip
llvm-32c501dd88b62787d3a5ffda7aabcf4650dbe3cd.tar.gz
llvm-32c501dd88b62787d3a5ffda7aabcf4650dbe3cd.tar.bz2
Module: Use FileEntryRef and DirectoryEntryRef in Umbrella, Header, and DirectoryName, NFC
Push `FileEntryRef` and `DirectoryEntryRef` further, using it them `Module::Umbrella`, `Module::Header::Entry`, and `Module::DirectoryName::Entry`. - Add `DirectoryEntryRef::operator const DirectoryEntry *` and `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr`, to get the same "degrades to `DirectoryEntry*` behaviour `FileEntryRef` enjoys (this avoids a bunch of churn in various clang tools). - Fix the `DirectoryEntryRef` constructor from `MapEntry` to take it by `const&`. Note that we cannot get rid of the `...AsWritten` names leveraging the new classes, since these need to be as written in the `ModuleMap` file and the module directory path is preprended for the lookup in the `FileManager`. Differential Revision: https://reviews.llvm.org/D90497
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 8a8c400..9284c59 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -247,7 +247,10 @@ Module::DirectoryName Module::getUmbrellaDir() const {
if (Header U = getUmbrellaHeader())
return {"", U.Entry->getDir()};
- return {UmbrellaAsWritten, Umbrella.dyn_cast<const DirectoryEntry *>()};
+ if (auto *ME = Umbrella.dyn_cast<const DirectoryEntryRef::MapEntry *>())
+ return {UmbrellaAsWritten, DirectoryEntryRef(*ME)};
+
+ return {"", None};
}
void Module::addTopHeader(const FileEntry *File) {