From 19131c7f36e047898ea954ee5a187ac62f2ab09b Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 28 Oct 2024 12:49:28 -0700 Subject: [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`. --- clang/lib/Lex/ModuleMap.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') 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 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; -- cgit v1.1