[clang][modules] Default `SourceLocation` parameter in `HeaderSearch::lookupModule`
authorJan Svoboda <jan_svoboda@apple.com>
Tue, 12 Oct 2021 07:55:40 +0000 (09:55 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Tue, 12 Oct 2021 07:58:54 +0000 (09:58 +0200)
This fixes an LLDB build failure where the `ImportLoc` argument is missing: https://lab.llvm.org/buildbot#builders/68/builds/19975

This change also makes it possible to drop `SourceLocation()` in `Preprocessor::getCurrentModule`.

clang/include/clang/Lex/HeaderSearch.h
clang/lib/Lex/Preprocessor.cpp

index 7b19e0d..372589d 100644 (file)
@@ -570,7 +570,8 @@ public:
   /// in subdirectories.
   ///
   /// \returns The module with the given name.
-  Module *lookupModule(StringRef ModuleName, SourceLocation ImportLoc,
+  Module *lookupModule(StringRef ModuleName,
+                       SourceLocation ImportLoc = SourceLocation(),
                        bool AllowSearch = true,
                        bool AllowExtraModuleMapSearch = false);
 
index 5aa831a..bf0b85e 100644 (file)
@@ -518,8 +518,7 @@ Module *Preprocessor::getCurrentModule() {
   if (!getLangOpts().isCompilingModule())
     return nullptr;
 
-  return getHeaderSearchInfo().lookupModule(getLangOpts().CurrentModule,
-                                            SourceLocation());
+  return getHeaderSearchInfo().lookupModule(getLangOpts().CurrentModule);
 }
 
 //===----------------------------------------------------------------------===//