Skip to content

problem with "deduction guide name" #81

@shi-yan

Description

@shi-yan

Our project uses the catch testing framework.

This framework is header only with a lot of templates. Woboq's generator can't handle it with the following error message:

./codebrowser_generator -p debug:/home/xxx/debug -o out /home/xxx/debug/test.cpp -- -std=c++1z
debug:out
debug:/home/xxx/debug
build path: 
file: /home/xxx/debug/test.cpp
[100%] Processing /home/xxx/debug/test.cpp
Can't mangle a deduction guide name!
UNREACHABLE executed at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:1476!
Aborted (core dumped)

I made a simple cpp file based on this example:

https://en.cppreference.com/w/cpp/language/class_template_argument_deduction#User-defined_deduction_guides

and this simple cpp file can reproduce the same issue seen with the catch2 testing framework.

the cpp file is attached here for debugging:

test.zip

This is the call stack that causes the abort:

#1  0x00007ffff6ca9801 in __GI_abort () at abort.c:79
#2  0x00005555578f8cf6 in llvm::llvm_unreachable_internal (msg=0x55555889e1d8 "Can't mangle a deduction guide name!", file=0x55555889deb8 "/home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp", 
    line=1476) at /home/xxx/llvm-project/llvm/lib/Support/ErrorHandling.cpp:209
#3  0x000055555738e60d in (anonymous namespace)::CXXNameMangler::mangleUnqualifiedName (this=0x7fffffffbb10, ND=0x55555a564728, Name=..., KnownArity=4294967295, AdditionalAbiTags=0x0)
    at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:1476
#4  0x000055555738b9a6 in (anonymous namespace)::CXXNameMangler::mangleUnqualifiedName (this=0x7fffffffbb10, ND=0x55555a564728, AdditionalAbiTags=0x0)
    at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:469
#5  0x000055555738ced0 in (anonymous namespace)::CXXNameMangler::mangleUnscopedName (this=0x7fffffffbb10, ND=0x55555a564728, AdditionalAbiTags=0x0)
    at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:954
#6  0x000055555738caa3 in (anonymous namespace)::CXXNameMangler::mangleNameWithAbiTags (this=0x7fffffffbb10, ND=0x55555a564728, AdditionalAbiTags=0x0)
    at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:891
#7  0x000055555738c875 in (anonymous namespace)::CXXNameMangler::mangleName (this=0x7fffffffbb10, ND=0x55555a564728) at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:842
#8  0x000055555738bec3 in (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding (this=0x7fffffffbb10, FD=0x55555a564728) at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:666
#9  0x000055555738bd35 in (anonymous namespace)::CXXNameMangler::mangle (this=0x7fffffffbb10, D=0x55555a564728) at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:645
#10 0x000055555739a20e in (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXName (this=0x555559c43df0, D=0x55555a564728, Out=...) at /home/xxx/llvm-project/clang/lib/AST/ItaniumMangle.cpp:4868
#11 0x00005555573ca31b in clang::MangleContext::mangleName (this=0x555559c43df0, D=0x55555a564728, Out=...) at /home/xxx/llvm-project/clang/lib/AST/Mangle.cpp:148
#12 0x000055555616c1f7 in Annotator::getReferenceAndTitle[abi:cxx11](clang::NamedDecl*) ()
#13 0x000055555616f49b in Annotator::registerReference(clang::NamedDecl*, clang::SourceRange, Annotator::TokenType, Annotator::DeclType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, clang::NamedDecl*) ()
#14 0x000055555614a7f1 in BrowserASTVisitor::VisitFunctionDecl(clang::FunctionDecl*) ()
#15 0x0000555556150af8 in clang::RecursiveASTVisitor<BrowserASTVisitor>::TraverseDecl(clang::Decl*) ()
#16 0x0000555556151903 in BrowserASTVisitor::TraverseDecl(clang::Decl*) ()
#17 0x00005555561504d5 in clang::RecursiveASTVisitor<BrowserASTVisitor>::TraverseDecl(clang::Decl*) ()
#18 0x0000555556151903 in BrowserASTVisitor::TraverseDecl(clang::Decl*) ()
#19 0x00005555561495c4 in clang::RecursiveASTVisitor<BrowserASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) [clone .part.3350] ()
#20 0x00005555561508f3 in clang::RecursiveASTVisitor<BrowserASTVisitor>::TraverseDecl(clang::Decl*) ()
#21 0x0000555556151903 in BrowserASTVisitor::TraverseDecl(clang::Decl*) ()
#22 0x0000555556151ae7 in BrowserASTConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#23 0x00005555563db15c in clang::ParseAST (S=..., PrintStats=false, SkipFunctionBodies=true) at /home/xxx/llvm-project/clang/lib/Parse/ParseAST.cpp:171
#24 0x0000555556196c65 in clang::ASTFrontendAction::ExecuteAction (this=0x555559bd7b90) at /home/xxx/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1041
#25 0x00005555561965c6 in clang::FrontendAction::Execute (this=0x555559bd7b90) at /home/xxx/llvm-project/clang/lib/Frontend/FrontendAction.cpp:934
#26 0x000055555620ade0 in clang::CompilerInstance::ExecuteAction (this=0x7fffffffc870, Act=warning: RTTI symbol not found for class 'BrowserAction'
...) at /home/xxx/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:944
#27 0x00005555576be87a in clang::tooling::FrontendActionFactory::runInvocation (this=0x555559bd5b20, Invocation=std::shared_ptr<clang::CompilerInvocation> (empty) = {...}, Files=0x7fffffffda80, 
    PCHContainerOps=std::shared_ptr<clang::PCHContainerOperations> (empty) = {...}, DiagConsumer=0x0) at /home/xxx/llvm-project/clang/lib/Tooling/Tooling.cpp:369
#28 0x00005555576be69f in clang::tooling::ToolInvocation::runInvocation (this=0x7fffffffd360, BinaryName=0x555559bd88e0 "/home/xxx/woboq_codebrowser/build/generator/clang-tool", 
    Compilation=0x555559bd8bb0, Invocation=std::shared_ptr<clang::CompilerInvocation> (empty) = {...}, PCHContainerOps=std::shared_ptr<clang::PCHContainerOperations> (empty) = {...})
    at /home/xxx/llvm-project/clang/lib/Tooling/Tooling.cpp:345
#29 0x00005555576be4a6 in clang::tooling::ToolInvocation::run (this=0x7fffffffd360) at /home/xxx/llvm-project/clang/lib/Tooling/Tooling.cpp:330
#30 0x0000555556148d49 in proceedCommand(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, llvm::StringRef, llvm::StringRef, clang::FileManager*, DatabaseType) ()
#31 0x0000555556145f88 in main ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions