aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2024-10-28 12:49:28 -0700
committerJan Svoboda <jan_svoboda@apple.com>2024-10-28 12:50:53 -0700
commit19131c7f36e047898ea954ee5a187ac62f2ab09b (patch)
tree55191ed8893f1c496afa585461e73d6c55217a9e /clang/lib/Lex/ModuleMap.cpp
parentad5b9441f949716570e89fcb27b76e9bfb4b7f70 (diff)
downloadllvm-19131c7f36e047898ea954ee5a187ac62f2ab09b.zip
llvm-19131c7f36e047898ea954ee5a187ac62f2ab09b.tar.gz
llvm-19131c7f36e047898ea954ee5a187ac62f2ab09b.tar.bz2
[clang][modules][lldb] Fix build after #113391
Instead of changing the return type of `ModuleMap::findOrCreateModule`, this patch adds a counterpart that only returns `Module *` and thus has the same signature as `createModule()`, which is important in `ASTReader`.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 1077442..dc9d2bf 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -655,8 +655,8 @@ ModuleMap::findOrCreateModuleForHeaderInUmbrellaDir(FileEntryRef File) {
SmallString<32> NameBuf;
StringRef Name = sanitizeFilenameAsIdentifier(
llvm::sys::path::stem(SkippedDir.getName()), NameBuf);
- Result =
- findOrCreateModule(Name, Result, /*IsFramework=*/false, Explicit);
+ Result = findOrCreateModuleFirst(Name, Result, /*IsFramework=*/false,
+ Explicit);
setInferredModuleAllowedBy(Result, UmbrellaModuleMap);
// Associate the module and the directory.
@@ -672,8 +672,8 @@ ModuleMap::findOrCreateModuleForHeaderInUmbrellaDir(FileEntryRef File) {
SmallString<32> NameBuf;
StringRef Name = sanitizeFilenameAsIdentifier(
llvm::sys::path::stem(File.getName()), NameBuf);
- Result =
- findOrCreateModule(Name, Result, /*IsFramework=*/false, Explicit);
+ Result = findOrCreateModuleFirst(Name, Result, /*IsFramework=*/false,
+ Explicit);
setInferredModuleAllowedBy(Result, UmbrellaModuleMap);
Result->addTopHeader(File);
@@ -857,14 +857,17 @@ Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{
return Context->findSubmodule(Name);
}
-Module *ModuleMap::findOrCreateModule(StringRef Name, Module *Parent,
- bool IsFramework, bool IsExplicit) {
+std::pair<Module *, bool> ModuleMap::findOrCreateModule(StringRef Name,
+ Module *Parent,
+ bool IsFramework,
+ bool IsExplicit) {
// Try to find an existing module with this name.
if (Module *Sub = lookupModuleQualified(Name, Parent))
- return Sub;
+ return std::make_pair(Sub, false);
// Create a new module with this name.
- return createModule(Name, Parent, IsFramework, IsExplicit);
+ Module *M = createModule(Name, Parent, IsFramework, IsExplicit);
+ return std::make_pair(M, true);
}
Module *ModuleMap::createModule(StringRef Name, Module *Parent,
@@ -2129,8 +2132,8 @@ void ModuleMapParser::parseModuleDecl() {
ActiveModule =
Map.createShadowedModule(ModuleName, Framework, ShadowingModule);
} else {
- ActiveModule =
- Map.findOrCreateModule(ModuleName, ActiveModule, Framework, Explicit);
+ ActiveModule = Map.findOrCreateModuleFirst(ModuleName, ActiveModule,
+ Framework, Explicit);
}
ActiveModule->DefinitionLoc = ModuleNameLoc;