Skip to content

Commit

Permalink
Implement demangling support for C++20 lambda expression extensions.
Browse files Browse the repository at this point in the history
This implements demangling support for the mangling extensions specified
in itanium-cxx-abi/cxx-abi#85, much of which is
implemented in Clang r359967 and r371004.

Specifically, this provides demangling for:

 * <template-param-decl> in <lambda-sig>
 * <template-param> with non-zero level
 * lambda-expression literals (not emitted by Clang yet)
 * nullptr literals
 * string literals

(The final two seem unrelated, but handling them was necessary in order
to disambiguate between lambda expressions and the other forms of
literal for which we have a type but no value.)

When demangling a <lambda-sig>, we form template parameters with no
corresponding argument, so we cannot substitute in the argument in the
demangling. Instead we invent synthetic names for the template
parameters (eg, '[]<typename $T>($T *x)').

git-svn-id: http://llvm.org/svn/llvm-project/libcxxabi/trunk@371273 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rsmith committed Sep 6, 2019
1 parent abe827a commit 0cf3e17
Show file tree
Hide file tree
Showing 3 changed files with 429 additions and 31 deletions.
10 changes: 10 additions & 0 deletions src/cxa_demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ struct DumpVisitor {
return printStr("SpecialSubKind::iostream");
}
}
void print(TemplateParamKind TPK) {
switch (TPK) {
case TemplateParamKind::Type:
return printStr("TemplateParamKind::Type");
case TemplateParamKind::NonType:
return printStr("TemplateParamKind::NonType");
case TemplateParamKind::Template:
return printStr("TemplateParamKind::Template");
}
}

void newLine() {
printStr("\n");
Expand Down
Loading

0 comments on commit 0cf3e17

Please sign in to comment.