[clang] [Serialization] Fix lazy template loading (PR #133057)

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 05:41:54 PDT 2025


alexfh wrote:

So far I found one assertion failure:
```
assert.h assertion failed at llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:3377 in const ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const RecordDecl *) const: D && "Cannot get layout of forward declarations!"
*** Check failure stack trace: ***                                                                                                                                                                                                                       @     0x55e7b65cf564  absl::log_internal::LogMessage::SendToLog()
    @     0x55e7b65cf525  absl::log_internal::LogMessage::Flush()
    @     0x55e7b67aed24  __assert_fail                                                                                                                                                                                                                  @     0x55e7b28c7646  clang::ASTContext::getASTRecordLayout()
    @     0x55e7b2295e48  clang::ASTContext::getTypeInfoImpl()
    @     0x55e7b2297297  clang::ASTContext::getTypeInfo()                                                                                                                                                                                               @     0x55e7b22979bc  clang::ASTContext::getTypeAlignInChars()
    @     0x55e7b07188d3  clang::CodeGen::CodeGenFunction::CreateIRTemp()
    @     0x55e7b09843bc  clang::CodeGen::CodeGenFunction::StartFunction()
    @     0x55e7b0986716  clang::CodeGen::CodeGenFunction::GenerateCode()
    @     0x55e7b09b20ec  clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition()
    @     0x55e7b09a9662  clang::CodeGen::CodeGenModule::EmitGlobalDefinition()
    @     0x55e7b099a226  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b099a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b099a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b099a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b099a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b099a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e7b0996c6e  clang::CodeGen::CodeGenModule::Release()
    @     0x55e7b0adc8ae  (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit()
    @     0x55e7b063685a  clang::BackendConsumer::HandleTranslationUnit()
    @     0x55e7b14daca8  clang::ParseAST()
    @     0x55e7b120f68a  clang::FrontendAction::Execute()
    @     0x55e7b118333d  clang::CompilerInstance::ExecuteAction()
    @     0x55e7b0635e2e  clang::ExecuteCompilerInvocation()
    @     0x55e7b0628f5e  cc1_main()
    @     0x55e7b0625f99  ExecuteCC1Tool()
    @     0x55e7b062874c  llvm::function_ref<>::callback_fn<>()
    @     0x55e7b1344afe  llvm::function_ref<>::callback_fn<>()
    @     0x55e7b64224bc  llvm::CrashRecoveryContext::RunSafely()
    @     0x55e7b1343fe4  clang::driver::CC1Command::Execute()
    @     0x55e7b13017b3  clang::driver::Compilation::ExecuteCommand()
    @     0x55e7b1301a4f  clang::driver::Compilation::ExecuteJobs()
    @     0x55e7b131bd20  clang::driver::Driver::ExecuteCompilation()
    @     0x55e7b06255a7  clang_main()
    @     0x55e7b06238f4  main
    @     0x7f012f05a352  __libc_start_main
    @     0x55e7b062382a  _start
```

Trying to produce a test case.

https://github.com/llvm/llvm-project/pull/133057


More information about the cfe-commits mailing list