[clang] 1341a2c - [clang][modules] Default `SourceLocation` parameter in `HeaderSearch::lookupModule`

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 12 00:59:00 PDT 2021


Author: Jan Svoboda
Date: 2021-10-12T09:58:54+02:00
New Revision: 1341a2c19e54cec77ccb35e3b4ee3924870b2e6a

URL: https://github.com/llvm/llvm-project/commit/1341a2c19e54cec77ccb35e3b4ee3924870b2e6a
DIFF: https://github.com/llvm/llvm-project/commit/1341a2c19e54cec77ccb35e3b4ee3924870b2e6a.diff

LOG: [clang][modules] Default `SourceLocation` parameter in `HeaderSearch::lookupModule`

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`.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index 7b19e0da87ec4..372589d75d965 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -570,7 +570,8 @@ class HeaderSearch {
   /// 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);
 

diff  --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 5aa831aa4eda6..bf0b85e038f05 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -518,8 +518,7 @@ Module *Preprocessor::getCurrentModule() {
   if (!getLangOpts().isCompilingModule())
     return nullptr;
 
-  return getHeaderSearchInfo().lookupModule(getLangOpts().CurrentModule,
-                                            SourceLocation());
+  return getHeaderSearchInfo().lookupModule(getLangOpts().CurrentModule);
 }
 
 //===----------------------------------------------------------------------===//


        


More information about the cfe-commits mailing list