-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"tools:llvm-cxxfilt
Description
Issue description
LLVM demangler fails to decode Itanium mangled name
_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
which encodes
foo::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>()
while other demanglers (i.e c++filt
) do not fail.
Possible causes
It seems that in llvm/Include/llvm/Demangle/ItaniumDemangle.h:3346
parser has been explicitly told not to try to parse template arguments in the names encoding C-style casts. I did not find any reason why this is illegal in the itanium C++ ABI
Possible patch provided in this pull request
How to reproduce
example.cpp
:
#include <iostream>
class foo {
public:
operator std::string() {return {};};
};
int main() {
(std::string) foo();
};
$ clang++ example.cpp -o example
$ llvm-nm example | llvm-cxxfilt example
output:
0000000000003dc0 d _DYNAMIC
0000000000004000 d _GLOBAL_OFFSET_TABLE_
00000000000010b0 t _GLOBAL__sub_I_example.cpp
0000000000002000 R _IO_stdin_used
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
00000000000011e0 W _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()@GLIBCXX_3.4.21
U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21
U std::ios_base::Init::Init()@GLIBCXX_3.4
U std::ios_base::Init::~Init()@GLIBCXX_3.4
0000000000004049 b std::__ioinit
0000000000002138 r __FRAME_END__
0000000000002004 r __GNU_EH_FRAME_HDR
0000000000004048 D __TMC_END__
000000000000037c r __abi_tag
0000000000004048 B __bss_start
U __cxa_atexit@GLIBC_2.2.5
w __cxa_finalize@GLIBC_2.2.5
0000000000001080 t __cxx_global_var_init
0000000000004038 D __data_start
0000000000001160 t __do_global_dtors_aux
0000000000003db8 d __do_global_dtors_aux_fini_array_entry
0000000000004040 D __dso_handle
0000000000003da8 d __frame_dummy_init_array_entry
w __gmon_start__
U __libc_start_main@GLIBC_2.34
0000000000004048 D _edata
0000000000004050 B _end
000000000000120c T _fini
0000000000001000 T _init
00000000000010c0 T _start
0000000000004048 b completed.0
0000000000004038 W data_start
00000000000010f0 t deregister_tm_clones
00000000000011a0 t frame_dummy
00000000000011b0 T main
0000000000001120 t register_tm_clones
demangle of line
00000000000011e0 W _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
has failed.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"tools:llvm-cxxfilt