[PATCH] D132900: [DWARF] Fix infinite recursion in Type Printer.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 10:12:43 PDT 2022


dblaikie added a comment.

In D132900#3801329 <https://reviews.llvm.org/D132900#3801329>, @ayermolo wrote:

>   class codecvt
>   {
>     public:
>       void out() const {}
>   };
>   
>   
>   void test() {
>     using _Codecvt = codecvt;
>     using _ConvFn = void(_Codecvt::*)() const;
>     _ConvFn __fn = &_Codecvt::out;
>   }
>
> So in both cases key to pathological case seems to be it's going through:
> appendSubroutineNameAfter: 	DW_TAG_subroutine_type
> appendQualifiedName: 	DW_TAG_pointer_type

So in this test case, with the patch I proposed (to have an explicit allowed list of names that get scopes, and so everything else doesn't get scopes) you got infinite recursion? Could you paste the stack trace in more detail - I'm a bit confused how we'd get infinite recursion on a pointer type if we're not printing scopes for pointer types anymore.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp:534
     First = false;
     if (P.getTag() == DW_TAG_unspecified_parameters)
       OS << "...";
----------------
ayermolo wrote:
> Maybe here is a better check? Something like D.getTag() == DW_TAG_subroutine_type, and also check T tag?
I'm not sure what you're referring to here, unfortunately - you mean adding a condition here in `appendSubroutineNameAfter`, around the `appendQualifiedName` call? I don't think so, but I'm not sure.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132900



More information about the llvm-commits mailing list