[clang] 28fa77f - [clang][modules] Avoid using uninitialized SourceLocation

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 13 02:24:08 PDT 2021


Author: Jan Svoboda
Date: 2021-10-13T11:24:01+02:00
New Revision: 28fa77feeb7db46abea1a6699d7a88a02d8dab46

URL: https://github.com/llvm/llvm-project/commit/28fa77feeb7db46abea1a6699d7a88a02d8dab46
DIFF: https://github.com/llvm/llvm-project/commit/28fa77feeb7db46abea1a6699d7a88a02d8dab46.diff

LOG: [clang][modules] Avoid using uninitialized SourceLocation

At this point, `F.ImportLoc` has not been initialized by the `ASTReader` yet and using it leads to an assertion failure.

Introduced in 638c673a8c3e27b6532049ac17ac9bc96640fc45 and 444513510999e4c1ea23253654196793834d53bf.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReader.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 563a76cd380a3..dc78e442a6951 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2924,7 +2924,7 @@ ASTReader::ReadControlBlock(ModuleFile &F,
       // If we've already loaded a module map file covering this module, we may
       // have a better path for it (relative to the current build).
       Module *M = PP.getHeaderSearchInfo().lookupModule(
-          F.ModuleName, F.ImportLoc, /*AllowSearch*/ true,
+          F.ModuleName, SourceLocation(), /*AllowSearch*/ true,
           /*AllowExtraModuleMapSearch*/ true);
       if (M && M->Directory) {
         // If we're implicitly loading a module, the base directory can't


        


More information about the cfe-commits mailing list