Add optional STL template-name simplification for undecorated C++ names
Summary
Adds an optional, display-only simplification of undecorated C++ names that collapses the canonical default-argument forms emitted by the MSVC demangler into their conventional STL spellings, e.g.
| Demangled | Simplified |
|---|---|
std::basic_string<char,std::char_traits<char>,std::allocator<char> > |
std::string |
std::basic_string_view<char,std::char_traits<char> > |
std::string_view |
std::vector<T,std::allocator<T> > |
std::vector<T> |
std::map<K,V,std::less<K>,std::allocator<std::pair<const K,V> > > |
std::map<K,V> |
std::unordered_map<K,V,std::hash<K>,std::equal_to<K>,std::allocator<...> > |
std::unordered_map<K,V> |
This makes long, allocator-/comparator-heavy template names far easier to read
in the imports/exports lists — the common request that motivated stl-filt.
Scope and design
- Only the default-value template forms of the standard library are matched:
basic_string/basic_string_view,vector/list/deque/forward_list,set/multiset,map/multimap,unordered_*, andunique_ptr. User templates and non-default arguments are left untouched. - The transform is bracket-aware (walks balanced angle brackets and folds
bottom-up) rather than regex-based, because nested template argument lists
(
std::map<int,std::vector<std::string> >, allocators wrappingstd::pairwith commas) cannot be split reliably with regular expressions. operator</operator<<, lambda names, and unbalanced input are guarded; any unexpected input is returned unchanged so a displayed name can never be corrupted.
UX
New "Simplify STL Template Names" checkbox on Configuration → Appearance (off by default). Toggling it clears the cached undecorated names and refreshes the view. It composes with the existing "Undecorate C++ Functions" option.
Implementation
Symbols/CStlNameSimplifier.cs— the standalone, WinForms-free transformer.CSymbolResolver.SimplifyTemplateDefaultsapplies it at the end ofUndecorateFunctionName.CConfiguration.SimplifyStlNames(persisted, default false), wired throughMainFormand the configuration form.
Tests
A decoupled xUnit project (WinDepends.StlSimplifier.Tests) links only the
simplifier source — no WinForms / windows-specific TFM — and covers folding,
bottom-up nesting, the function-signature case, operator</<< guards, user
templates, and malformed-input fallbacks. 23/23 passing.
Incidental
The repository had no .gitignore; one for .NET/C++ build artifacts is included
as a separate commit. Happy to drop it from this PR if you'd prefer it separate.
🤖 Generated with Claude Code