Skip to content

Commit

Permalink
__cxa_demangle: Fix constructor cv qualifier handling
Browse files Browse the repository at this point in the history
Summary:
Previously if we parsed a constructor then we set parsed_ctor_dtor_cv
to true and never reseted it. This causes issue when a template argument
references a constructor (e.g. type of lambda defined inside a
constructor) as we will have the parsed_ctor_dtor_cv flag set what will
cause issues when parsing later arguments.

Reviewers: EricWF, compnerd

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33385

llvm-svn: 303737
  • Loading branch information
Tamas Berghammer committed May 24, 2017
1 parent 9f46d1d commit 8bc9b88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libcxxabi/src/cxa_demangle.cpp
Expand Up @@ -4571,6 +4571,8 @@ parse_encoding(const char* first, const char* last, C& db)
save_value<decltype(db.tag_templates)> sb(db.tag_templates);
if (db.encoding_depth > 1)
db.tag_templates = true;
save_value<decltype(db.parsed_ctor_dtor_cv)> sp(db.parsed_ctor_dtor_cv);
db.parsed_ctor_dtor_cv = false;
switch (*first)
{
case 'G':
Expand Down
1 change: 1 addition & 0 deletions libcxxabi/test/test_demangle.pass.cpp
Expand Up @@ -29500,6 +29500,7 @@ const char* cases[][2] =
{"_ZZ2f6vE1b", "f6()::b"},
{"_ZNV3$_35test9Ev", "$_3::test9() volatile"},
{"_ZN5Test8I3$_2EC1ES0_", "Test8<$_2>::Test8($_2)"},
{"_Z3fooIZN3BarC1EvE3$_0EvT_", "void foo<Bar::Bar()::$_0>(Bar::Bar()::$_0)"},
{"_ZGVZN1N1gEvE1a", "guard variable for N::g()::a"},
{"_ZplRK1YRA100_P1X", "operator+(Y const&, X* (&) [100])"},
{"_Z1fno", "f(__int128, unsigned __int128)"},
Expand Down

0 comments on commit 8bc9b88

Please sign in to comment.