[lldb-dev] std::string name mangling

Alex Pepper apepper at blueshiftinc.com
Thu Jul 3 13:06:06 PDT 2014


I have been debugging LLDB trying to find where the name mangling is 
getting messed up during eval parsing of std::string::c_str() and have 
traced it into CXXNameMangler::mangleStandardSubstitution in 
ItaniumMangle.cpp which is part of clangs AST module.  In 
mangleStandardSubstitution it is testing the identifier to see if it is 
a ClassTemplateSpecializationDecl equivalent to 
std::basic_string<char,std::char_traits<char>,std::allocator<char>> so 
that it can substitute the short form mangled string "Ss".  This check 
fails on the second template argument test where it is checking if it is 
a char specialization of char_traits.

if (!isCharSpecialization(TemplateArgs[1].getAsType(), "char_traits"))
         return false;

I have dumped the declaration to verify it is the correct identifier:
class basic_string definition
|-TemplateArgument type 'char'
|-TemplateArgument type 'struct std::char_traits<char>'
|-TemplateArgument type 'class std::allocator<char>'

I also dumped the template arguments separately:
char identifier
struct std::char_traits<char> identifier
class std::allocator<char> identifier

I am not familiar enough yet with the Clang architecture to understand 
why this check is failing.  Any suggestions on how to track this down 
would be appreciated.

- Alex




More information about the lldb-dev mailing list