aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Basic/Module.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Module.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/contrib/llvm-project/clang/lib/Basic/Module.cpp b/contrib/llvm-project/clang/lib/Basic/Module.cpp
index b3daaa3a4442..2dd53b05d442 100644
--- a/contrib/llvm-project/clang/lib/Basic/Module.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Module.cpp
@@ -44,7 +44,7 @@ Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
InferSubmodules(false), InferExplicitSubmodules(false),
InferExportWildcard(false), ConfigMacrosExhaustive(false),
NoUndeclaredIncludes(false), ModuleMapIsPrivate(false),
- HasUmbrellaDir(false), NameVisibility(Hidden) {
+ NameVisibility(Hidden) {
if (Parent) {
IsAvailable = Parent->isAvailable();
IsUnimportable = Parent->isUnimportable();
@@ -75,7 +75,7 @@ static bool isPlatformEnvironment(const TargetInfo &Target, StringRef Feature) {
return true;
auto CmpPlatformEnv = [](StringRef LHS, StringRef RHS) {
- auto Pos = LHS.find("-");
+ auto Pos = LHS.find('-');
if (Pos == StringRef::npos)
return false;
SmallString<128> NewLHS = LHS.slice(0, Pos);
@@ -173,14 +173,10 @@ bool Module::isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
}
bool Module::isSubModuleOf(const Module *Other) const {
- const Module *This = this;
- do {
- if (This == Other)
+ for (auto *Parent = this; Parent; Parent = Parent->Parent) {
+ if (Parent == Other)
return true;
-
- This = This->Parent;
- } while (This);
-
+ }
return false;
}
@@ -251,7 +247,10 @@ Module::DirectoryName Module::getUmbrellaDir() const {
if (Header U = getUmbrellaHeader())
return {"", U.Entry->getDir()};
- return {UmbrellaAsWritten, static_cast<const DirectoryEntry *>(Umbrella)};
+ if (auto *ME = Umbrella.dyn_cast<const DirectoryEntryRef::MapEntry *>())
+ return {UmbrellaAsWritten, DirectoryEntryRef(*ME)};
+
+ return {"", None};
}
void Module::addTopHeader(const FileEntry *File) {
@@ -675,7 +674,7 @@ ASTSourceDescriptor::ASTSourceDescriptor(Module &M)
: Signature(M.Signature), ClangModule(&M) {
if (M.Directory)
Path = M.Directory->getName();
- if (auto *File = M.getASTFile())
+ if (auto File = M.getASTFile())
ASTFile = File->getName();
}