[PATCH] D140562: [clang][ASTImporter] Improve import of InjectedClassNameType.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 09:35:06 PST 2022


balazske added a comment.

This crash is produced if the test is run without the fix:

  [ RUN      ] ParameterizedTests/ASTImporterOptionSpecificTestBase.ImportInjectedClassNameType/0
  ASTTests: llvm-project/clang/lib/AST/ASTContext.cpp:4678: clang::QualType clang::ASTContext::getTypedefType(const clang::TypedefNameDecl *, clang::QualType) const: Assertion `hasSameType(Decl->getUnderlyingType(), Underlying)' failed.
   #0 0x00007fd8cc15141a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm-project/llvm/lib/Support/Unix/Signals.inc:567:11
   #1 0x00007fd8cc1515eb PrintStackTraceSignalHandler(void*) llvm-project/llvm/lib/Support/Unix/Signals.inc:641:1
   #2 0x00007fd8cc14fb9b llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:103:5
   #3 0x00007fd8cc151d61 SignalHandler(int) llvm-project/llvm/lib/Support/Unix/Signals.inc:412:1
   #4 0x00007fd8cf630980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
   #5 0x00007fd8cb018e87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
   #6 0x00007fd8cb01a7f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
   #7 0x00007fd8cb00a3fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0
   #8 0x00007fd8cb00a472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
   #9 0x00007fd8cd95cf20 clang::ASTContext::getTypedefType(clang::TypedefNameDecl const*, clang::QualType) const llvm-project/clang/lib/AST/ASTContext.cpp:4680:26
  #10 0x00007fd8cda9a574 clang::ASTNodeImporter::VisitTypedefType(clang::TypedefType const*) llvm-project/clang/lib/AST/ASTImporter.cpp:1365:34
  #11 0x00007fd8cdb05191 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType>>::Visit(clang::Type const*) build/Debug/tools/clang/include/clang/AST/TypeNodes.inc:75:1
  #12 0x00007fd8cdad0d35 clang::ASTImporter::Import(clang::Type const*) llvm-project/clang/lib/AST/ASTImporter.cpp:8651:8
  #13 0x00007fd8cdad0ea8 clang::ASTImporter::Import(clang::QualType) llvm-project/clang/lib/AST/ASTImporter.cpp:8665:8
  #14 0x00007fd8cdadb809 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) llvm-project/clang/lib/AST/ASTImporter.cpp:219:23
  #15 0x00007fd8cda9be49 clang::ASTNodeImporter::VisitElaboratedType(clang::ElaboratedType const*) llvm-project/clang/lib/AST/ASTImporter.cpp:1595:8
  #16 0x00007fd8cdb04eb9 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType>>::Visit(clang::Type const*) build/Debug/tools/clang/include/clang/AST/TypeNodes.inc:45:1
  #17 0x00007fd8cdad0d35 clang::ASTImporter::Import(clang::Type const*) llvm-project/clang/lib/AST/ASTImporter.cpp:8651:8
  #18 0x00007fd8cdad0ea8 clang::ASTImporter::Import(clang::QualType) llvm-project/clang/lib/AST/ASTImporter.cpp:8665:8
  #19 0x00007fd8cdadb809 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) llvm-project/clang/lib/AST/ASTImporter.cpp:219:23
  #20 0x00007fd8cda98d9b clang::ASTNodeImporter::VisitPointerType(clang::PointerType const*) llvm-project/clang/lib/AST/ASTImporter.cpp:1155:8
  #21 0x00007fd8cdb0505d clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType>>::Visit(clang::Type const*) build/Debug/tools/clang/include/clang/AST/TypeNodes.inc:62:1
  #22 0x00007fd8cdad0d35 clang::ASTImporter::Import(clang::Type const*) llvm-project/clang/lib/AST/ASTImporter.cpp:8651:8
  #23 0x00007fd8cdad0ea8 clang::ASTImporter::Import(clang::QualType) llvm-project/clang/lib/AST/ASTImporter.cpp:8665:8
  #24 0x00007fd8cdadb809 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) llvm-project/clang/lib/AST/ASTImporter.cpp:219:23
  #25 0x00007fd8cda99d11 clang::ASTNodeImporter::VisitFunctionProtoType(clang::FunctionProtoType const*) llvm-project/clang/lib/AST/ASTImporter.cpp:1299:10
  #26 0x00007fd8cdb04ef1 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType>>::Visit(clang::Type const*) build/Debug/tools/clang/include/clang/AST/TypeNodes.inc:48:1
  #27 0x00007fd8cdad0d35 clang::ASTImporter::Import(clang::Type const*) llvm-project/clang/lib/AST/ASTImporter.cpp:8651:8
  #28 0x00007fd8cdad0ea8 clang::ASTImporter::Import(clang::QualType) llvm-project/clang/lib/AST/ASTImporter.cpp:8665:8
  #29 0x00007fd8cdadb809 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) llvm-project/clang/lib/AST/ASTImporter.cpp:219:23
  #30 0x00007fd8cdaddb5b clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&) llvm-project/clang/lib/AST/ASTImporter.cpp:698:12
  #31 0x00007fd8cdaa8c38 clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) llvm-project/clang/lib/AST/ASTImporter.cpp:3597:12
  #32 0x00007fd8cdaaabae clang::ASTNodeImporter::VisitCXXMethodDecl(clang::CXXMethodDecl*) llvm-project/clang/lib/AST/ASTImporter.cpp:3810:10
  #33 0x00007fd8cdb04361 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) build/Debug/tools/clang/include/clang/AST/DeclNodes.inc:443:1
  #34 0x00007fd8cdad0a26 clang::ASTImporter::ImportImpl(clang::Decl*) llvm-project/clang/lib/AST/ASTImporter.cpp:8619:19
  #35 0x00007fd8cdab3a72 clang::ASTImporter::Import(clang::Decl*) llvm-project/clang/lib/AST/ASTImporter.cpp:9008:8
  #36 0x000000000064c702 clang::ast_matchers::ASTImporterTestBase::TU::import(std::shared_ptr<clang::ASTImporterSharedState> const&, clang::ASTUnit*, clang::Decl*) llvm-project/clang/unittests/AST/ASTImporterFixtures.cpp:83:12
  #37 0x000000000064d4c2 clang::ast_matchers::ASTImporterTestBase::Import(clang::Decl*, clang::TestLanguage) llvm-project/clang/unittests/AST/ASTImporterFixtures.cpp:199:9
  #38 0x00000000006da446 clang::FunctionDecl* clang::ast_matchers::ASTImporterTestBase::Import<clang::FunctionDecl>(clang::FunctionDecl*, clang::TestLanguage) llvm-project/clang/unittests/AST/ASTImporterFixtures.h:185:12
  #39 0x00000000006c836d clang::ast_matchers::ASTImporterOptionSpecificTestBase_ImportInjectedClassNameType_Test::TestBody() llvm-project/clang/unittests/AST/ASTImporterTest.cpp:8102:15
  #40 0x00007fd8cc2559c4 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) llvm-project/third-party/unittest/googletest/src/gtest.cc:2433:3
  #41 0x00007fd8cc23b132 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) llvm-project/third-party/unittest/googletest/src/gtest.cc:2488:5
  #42 0x00007fd8cc223173 testing::Test::Run() llvm-project/third-party/unittest/googletest/src/gtest.cc:2515:3
  #43 0x00007fd8cc223a4d testing::TestInfo::Run() llvm-project/third-party/unittest/googletest/src/gtest.cc:2687:12
  #44 0x00007fd8cc22401c testing::TestSuite::Run() llvm-project/third-party/unittest/googletest/src/gtest.cc:2815:44
  #45 0x00007fd8cc22cde1 testing::internal::UnitTestImpl::RunAllTests() llvm-project/third-party/unittest/googletest/src/gtest.cc:5337:24
  #46 0x00007fd8cc2591e4 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) llvm-project/third-party/unittest/googletest/src/gtest.cc:2433:3
  #47 0x00007fd8cc23d472 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) llvm-project/third-party/unittest/googletest/src/gtest.cc:2488:5
  #48 0x00007fd8cc22c9aa testing::UnitTest::Run() llvm-project/third-party/unittest/googletest/src/gtest.cc:4925:10
  #49 0x00007fd8cfa43d01 RUN_ALL_TESTS() llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2472:3
  #50 0x00007fd8cfa43c40 main llvm-project/third-party/unittest/UnitTestMain/TestMain.cpp:55:3
  #51 0x00007fd8caffbc87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
  #52 0x00000000005eeb1a _start (tools/clang/unittests/AST/ASTTests+0x5eeb1a)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140562/new/

https://reviews.llvm.org/D140562



More information about the cfe-commits mailing list