[PATCH] D50948: lambdas in modules: change storage for LambdaDefinitionData

Steve O'Brien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 19 12:26:02 PDT 2018


elsteveogrande added a comment.

I did try a copy of https://reviews.llvm.org/D50949 again, locally and without this diff, to see if I can avoid messing with this structure altogether.  But then I get a `SEGV`.

The reason behind this diff is to try to make the logic a little safer, though it's probably still not bulletproof.  It at least does seem to fix, or "fix" (i.e. hide) the crash below.

I admit I didn't take the time to really dig into that one, and I'm not yet experienced enough in Clang's code to do so confidently, so it's a bit scary to continue going down rabbit holes :)

But I'm happy to revise (or go fix that problem) if you think that's best.  Thanks again!

  Stack dump:
  0.	Program arguments: /opt/llvm/build/bin/clang -cc1 -internal-isystem /opt/llvm/build/lib/clang/8.0.0/include -nostdsysteminc -fmodules -verify /opt/llvm/llvm/tools/clang/test/Modules/merge-lambdas.cpp -emit-llvm-only
  1.	/opt/llvm/llvm/tools/clang/test/Modules/merge-lambdas.cpp:73:1: at annotation token
  2.	/opt/llvm/build/tools/clang/test/Modules/PR38531.map:11:14: LLVM IR generation of declaration 'foo(Fun)::(anonymous class)::'
  0  clang                    0x00000001032cffe8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
  1  clang                    0x00000001032cf165 llvm::sys::RunSignalHandlers() + 85
  2  clang                    0x00000001032d05f2 SignalHandler(int) + 258
  3  libsystem_platform.dylib 0x00007fff79709f5a _sigtramp + 26
  4  libsystem_platform.dylib 0x00007ffeed8dbe3f _sigtramp + 1948065535
  5  clang                    0x0000000104b865b1 (anonymous namespace)::CXXNameMangler::manglePrefix(clang::DeclContext const*, bool) + 545
  6  clang                    0x0000000104b877d5 (anonymous namespace)::CXXNameMangler::mangleNestedName(clang::NamedDecl const*, clang::DeclContext const*, llvm::SmallVector<llvm::StringRef, 4u> const*, bool) + 453
  7  clang                    0x0000000104b8733d (anonymous namespace)::CXXNameMangler::mangleLocalName(clang::Decl const*, llvm::SmallVector<llvm::StringRef, 4u> const*) + 1613
  8  clang                    0x0000000104b77bf7 (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*) + 87
  9  clang                    0x0000000104b760c5 (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXCtor(clang::CXXConstructorDecl const*, clang::CXXCtorType, llvm::raw_ostream&) + 245
  10 clang                    0x000000010368eb21 getMangledNameImpl(clang::CodeGen::CodeGenModule const&, clang::GlobalDecl, clang::NamedDecl const*, bool) + 305
  11 clang                    0x000000010368a83b clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) + 427
  12 clang                    0x0000000103697135 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1941
  13 clang                    0x00000001036f7529 (anonymous namespace)::ItaniumCXXABI::EmitCXXConstructors(clang::CXXConstructorDecl const*) + 41
  14 clang                    0x000000010371401f (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 143
  15 clang                    0x000000010367a151 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 177
  16 clang                    0x000000010367a244 clang::BackendConsumer::HandleInterestingDecl(clang::DeclGroupRef) + 20
  17 clang                    0x000000010427c2db clang::ASTReader::PassInterestingDeclsToConsumer() + 123
  18 clang                    0x0000000104243f8b clang::ASTReader::FinishedDeserializing() + 1867
  19 clang                    0x000000010427be48 clang::ASTReader::ReadDeclRecord(unsigned int) + 2808
  20 clang                    0x000000010422b219 non-virtual thunk to clang::ASTReader::GetExternalDecl(unsigned int) + 89
  21 clang                    0x0000000104afe7a1 clang::RedeclarableTemplateDecl::loadLazySpecializationsImpl() const + 241
  22 clang                    0x0000000104aff1dc clang::ClassTemplateDecl::findSpecialization(llvm::ArrayRef<clang::TemplateArgument>, void*&) + 28
  23 clang                    0x00000001048096a2 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) + 1170
  24 clang                    0x000000010480c900 clang::Sema::ActOnTemplateIdType(clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, bool, bool) + 1552
  25 clang                    0x00000001041df3b1 clang::Parser::AnnotateTemplateIdTokenAsType(bool) + 129
  26 clang                    0x000000010416449a clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10410
  27 clang                    0x00000001041eb69b clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 139
  28 clang                    0x00000001041eb367 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 343
  29 clang                    0x00000001041e9a99 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 2521
  30 clang                    0x00000001041e8bd0 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 688
  31 clang                    0x00000001041537a5 clang::ParseAST(clang::Sema&, bool, bool) + 453
  32 clang                    0x00000001038a8ed3 clang::FrontendAction::Execute() + 67
  33 clang                    0x00000001038650f8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1272
  34 clang                    0x00000001038f9858 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1688
  35 clang                    0x0000000102326339 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1401
  36 clang                    0x00000001023243e0 main + 10320
  37 libdyld.dylib            0x00007fff793fb015 start + 1
  /opt/llvm/build/tools/clang/test/Modules/Output/merge-lambdas.cpp.script: line 1: 62496 Segmentation fault: 11  /opt/llvm/build/bin/clang -cc1 -internal-isystem /opt/llvm/build/lib/clang/8.0.0/include -nostdsysteminc -fmodules -verify /opt/llvm/llvm/tools/clang/test/Modules/merge-lambdas.cpp -emit-llvm-only


Repository:
  rC Clang

https://reviews.llvm.org/D50948





More information about the cfe-commits mailing list