@@ -592,7 +592,7 @@ class NodeAllocator {
592
592
public:
593
593
void reset () { Alloc.Reset (); }
594
594
595
- template <typename T, typename ... Args> T *makeNode (Args &&... args) {
595
+ template <typename T, typename ... Args> T *makeNode (Args &&...args) {
596
596
return new (Alloc.Allocate (sizeof (T), alignof (T)))
597
597
T (std::forward<Args>(args)...);
598
598
}
@@ -614,7 +614,7 @@ class ManglingSubstitutor
614
614
ManglingSubstitutor () : Base(nullptr , nullptr ) {}
615
615
616
616
template <typename ... Ts>
617
- ConstString substitute (llvm::StringRef Mangled, Ts &&... Vals) {
617
+ ConstString substitute (llvm::StringRef Mangled, Ts &&...Vals) {
618
618
this ->getDerived ().reset (Mangled, std::forward<Ts>(Vals)...);
619
619
return substituteImpl (Mangled);
620
620
}
@@ -1449,47 +1449,50 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1449
1449
stl_deref_flags.SetFrontEndWantsDereference ();
1450
1450
1451
1451
cpp_category_sp->AddTypeSynthetic (
1452
- " ^std::vector<.+>(( )?&)?$" , eFormatterMatchRegex,
1452
+ " ^std::(__debug::)? vector<.+>(( )?&)?$" , eFormatterMatchRegex,
1453
1453
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1454
1454
stl_synth_flags,
1455
1455
" lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider" )));
1456
1456
cpp_category_sp->AddTypeSynthetic (
1457
- " ^std::map<.+> >(( )?&)?$" , eFormatterMatchRegex,
1457
+ " ^std::(__debug::)? map<.+> >(( )?&)?$" , eFormatterMatchRegex,
1458
1458
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1459
1459
stl_synth_flags,
1460
1460
" lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider" )));
1461
1461
cpp_category_sp->AddTypeSynthetic (
1462
- " ^std::deque<.+>(( )?&)?$" , eFormatterMatchRegex,
1462
+ " ^std::(__debug)? deque<.+>(( )?&)?$" , eFormatterMatchRegex,
1463
1463
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1464
1464
stl_deref_flags,
1465
1465
" lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider" )));
1466
1466
cpp_category_sp->AddTypeSynthetic (
1467
- " ^std::set<.+> >(( )?&)?$" , eFormatterMatchRegex,
1467
+ " ^std::(__debug::)? set<.+> >(( )?&)?$" , eFormatterMatchRegex,
1468
1468
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1469
1469
stl_deref_flags,
1470
1470
" lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider" )));
1471
1471
cpp_category_sp->AddTypeSynthetic (
1472
- " ^std::multimap<.+> >(( )?&)?$" , eFormatterMatchRegex,
1472
+ " ^std::(__debug::)? multimap<.+> >(( )?&)?$" , eFormatterMatchRegex,
1473
1473
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1474
1474
stl_deref_flags,
1475
1475
" lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider" )));
1476
1476
cpp_category_sp->AddTypeSynthetic (
1477
- " ^std::multiset<.+> >(( )?&)?$" , eFormatterMatchRegex,
1477
+ " ^std::(__debug::)? multiset<.+> >(( )?&)?$" , eFormatterMatchRegex,
1478
1478
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1479
1479
stl_deref_flags,
1480
1480
" lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider" )));
1481
1481
cpp_category_sp->AddTypeSynthetic (
1482
- " ^std::unordered_(multi)?(map|set)<.+> >$" , eFormatterMatchRegex,
1482
+ " ^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$" ,
1483
+ eFormatterMatchRegex,
1483
1484
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1484
1485
stl_deref_flags,
1485
1486
" lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider" )));
1486
1487
cpp_category_sp->AddTypeSynthetic (
1487
- " ^std::(__cxx11::)?list<.+>(( )?&)?$" , eFormatterMatchRegex,
1488
+ " ^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$" ,
1489
+ eFormatterMatchRegex,
1488
1490
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1489
1491
stl_deref_flags,
1490
1492
" lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider" )));
1491
1493
cpp_category_sp->AddTypeSynthetic (
1492
- " ^std::(__cxx11::)?forward_list<.+>(( )?&)?$" , eFormatterMatchRegex,
1494
+ " ^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$" ,
1495
+ eFormatterMatchRegex,
1493
1496
SyntheticChildrenSP (new ScriptedSyntheticChildren (
1494
1497
stl_synth_flags,
1495
1498
" lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider" )));
@@ -1501,44 +1504,47 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1501
1504
1502
1505
stl_summary_flags.SetDontShowChildren (false );
1503
1506
stl_summary_flags.SetSkipPointers (false );
1504
- cpp_category_sp->AddTypeSummary (" ^std::bitset<.+>(( )?&)?$" ,
1505
- eFormatterMatchRegex,
1506
- TypeSummaryImplSP (new StringSummaryFormat (
1507
- stl_summary_flags, " size=${svar%#}" )));
1508
- cpp_category_sp->AddTypeSummary (" ^std::vector<.+>(( )?&)?$" ,
1509
- eFormatterMatchRegex,
1510
- TypeSummaryImplSP (new StringSummaryFormat (
1511
- stl_summary_flags, " size=${svar%#}" )));
1512
- cpp_category_sp->AddTypeSummary (" ^std::map<.+> >(( )?&)?$" ,
1507
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?bitset<.+>(( )?&)?$" ,
1513
1508
eFormatterMatchRegex,
1514
1509
TypeSummaryImplSP (new StringSummaryFormat (
1515
1510
stl_summary_flags, " size=${svar%#}" )));
1516
- cpp_category_sp->AddTypeSummary (" ^std::set <.+> >(( )?&)?$" ,
1511
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?vector <.+>(( )?&)?$" ,
1517
1512
eFormatterMatchRegex,
1518
1513
TypeSummaryImplSP (new StringSummaryFormat (
1519
1514
stl_summary_flags, " size=${svar%#}" )));
1520
- cpp_category_sp->AddTypeSummary (" ^std::deque <.+>(( )?&)?$" ,
1515
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?map <.+> >(( )?&)?$" ,
1521
1516
eFormatterMatchRegex,
1522
1517
TypeSummaryImplSP (new StringSummaryFormat (
1523
1518
stl_summary_flags, " size=${svar%#}" )));
1524
- cpp_category_sp->AddTypeSummary (" ^std::multimap <.+> >(( )?&)?$" ,
1519
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?set <.+> >(( )?&)?$" ,
1525
1520
eFormatterMatchRegex,
1526
1521
TypeSummaryImplSP (new StringSummaryFormat (
1527
1522
stl_summary_flags, " size=${svar%#}" )));
1528
- cpp_category_sp->AddTypeSummary (" ^std::multiset <.+> >(( )?&)?$" ,
1523
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?deque <.+>(( )?&)?$" ,
1529
1524
eFormatterMatchRegex,
1530
1525
TypeSummaryImplSP (new StringSummaryFormat (
1531
1526
stl_summary_flags, " size=${svar%#}" )));
1532
- cpp_category_sp->AddTypeSummary (" ^std::unordered_(multi)?(map|set) <.+> >$" ,
1527
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug::)?multimap <.+> >(( )?&)? $" ,
1533
1528
eFormatterMatchRegex,
1534
1529
TypeSummaryImplSP (new StringSummaryFormat (
1535
1530
stl_summary_flags, " size=${svar%#}" )));
1536
- cpp_category_sp->AddTypeSummary (" ^std::(__cxx11 ::)?list <.+>(( )?&)?$" ,
1531
+ cpp_category_sp->AddTypeSummary (" ^std::(__debug ::)?multiset <.+> >(( )?&)?$" ,
1537
1532
eFormatterMatchRegex,
1538
1533
TypeSummaryImplSP (new StringSummaryFormat (
1539
1534
stl_summary_flags, " size=${svar%#}" )));
1540
1535
cpp_category_sp->AddTypeSummary (
1541
- " ^std::(__cxx11::)?forward_list<.+>(( )?&)?$" , eFormatterMatchRegex,
1536
+ " ^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$" ,
1537
+ eFormatterMatchRegex,
1538
+ TypeSummaryImplSP (
1539
+ new StringSummaryFormat (stl_summary_flags, " size=${svar%#}" )));
1540
+ cpp_category_sp->AddTypeSummary (
1541
+ " ^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$" ,
1542
+ eFormatterMatchRegex,
1543
+ TypeSummaryImplSP (
1544
+ new StringSummaryFormat (stl_summary_flags, " size=${svar%#}" )));
1545
+ cpp_category_sp->AddTypeSummary (
1546
+ " ^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$" ,
1547
+ eFormatterMatchRegex,
1542
1548
TypeSummaryImplSP (new ScriptSummaryFormat (
1543
1549
stl_summary_flags,
1544
1550
" lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider" )));
@@ -1592,7 +1598,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1592
1598
AddCXXSynthetic (
1593
1599
cpp_category_sp,
1594
1600
lldb_private::formatters::LibStdcppBitsetSyntheticFrontEndCreator,
1595
- " std::bitset synthetic child" , " ^std::bitset<.+>(( )?&)?$" ,
1601
+ " std::bitset synthetic child" , " ^std::(__debug::)? bitset<.+>(( )?&)?$" ,
1596
1602
stl_deref_flags, true );
1597
1603
1598
1604
AddCXXSynthetic (
@@ -1731,8 +1737,12 @@ lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
1731
1737
DataVisualization::Categories::GetCategory (ConstString (GetPluginName ()),
1732
1738
g_category);
1733
1739
if (g_category) {
1734
- LoadLibStdcppFormatters (g_category);
1740
+ // NOTE: the libstdcpp formatters are loaded after libcxx formatters
1741
+ // because we don't want to the libcxx formatters to match the potential
1742
+ // `__debug` inline namespace that libstdcpp may use.
1743
+ // LLDB prioritizes the last loaded matching formatter.
1735
1744
LoadLibCxxFormatters (g_category);
1745
+ LoadLibStdcppFormatters (g_category);
1736
1746
LoadSystemFormatters (g_category);
1737
1747
}
1738
1748
});
0 commit comments