[Lldb-commits] [PATCH] D134378: [lldb] Support simplified template names

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 6 02:46:25 PDT 2022


Michael137 added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:1528
+DWARFASTParserClang::GetTemplateParametersString(const DWARFDIE &die) {
+  if (llvm::StringRef(die.GetName()).contains("<"))
+    return std::string();
----------------
Michael137 wrote:
> Can this affect `operator<` at all? Haven't thought much about it but that's one construct that comes to mind that can contain `<`
> 
> ```
> $ cat operator.cpp 
> template<typename T>
> struct Foo {
>     int x = 0;
> 
>     template<typename U>
>     friend bool operator<(Foo<U> const& lhs, Foo<U> const& rhs) {
>         return lhs.x < rhs.x;
>     }
> };
> 
> int main() {
>     Foo<int> x;
>     Foo<int> y;
>     return x < y;
> }
> ```
> 
> ```
> 0x000000c8:   DW_TAG_subprogram                                    
>                 DW_AT_low_pc    (0x0000000100003f5c)               
>                 DW_AT_high_pc   (0x0000000100003f8c)               
>                 DW_AT_APPLE_omit_frame_ptr      (true)        
>                 DW_AT_frame_base        (DW_OP_reg31 WSP)          
>                 DW_AT_linkage_name      ("_ZltIiEbRK3FooIT_ES4_")  
>                 DW_AT_name      ("operator<<int>")                 
>                 DW_AT_decl_file ("/Users/michaelbuch/operator.cpp")
>                 DW_AT_decl_line (6)                                
>                 DW_AT_type      (0x0000000000000135 "bool")        
>                 DW_AT_external  (true)                             
> ```
Looks like `-gsimple-template-names` leaves the template params in `DW_AT_name` in this case so we're fine? Would be nice to test though


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134378/new/

https://reviews.llvm.org/D134378



More information about the lldb-commits mailing list