[all-commits] [llvm/llvm-project] 10b048: [lldb] Make CompilerDecl::GetName (always) return ...

Pavel Labath via All-commits all-commits at lists.llvm.org
Fri Nov 15 03:24:34 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 10b048c8922d746b14e991f468e00b3ca67c9d95
      https://github.com/llvm/llvm-project/commit/10b048c8922d746b14e991f468e00b3ca67c9d95
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    A lldb/test/API/lang/cpp/forward/Makefile
    A lldb/test/API/lang/cpp/forward/TestCPPForwardDeclaration.py
    A lldb/test/API/lang/cpp/forward/foo.cpp
    A lldb/test/API/lang/cpp/forward/foo.h
    A lldb/test/API/lang/cpp/forward/main.cpp

  Log Message:
  -----------
  [lldb] Make CompilerDecl::GetName (always) return template args (#116068)

I ran into this while look at a different bug (patch coming soon). This
function has only two callers. The first is SBTypeStaticField::GetName
(which doesn't care about templates), and the other is
CompilerDecl::GetCompilerContext (in the TypeQuery constructor), which
does want template arguments.

This function was (normally) returning the name without template args.
Since this code is only used when looking up a type in another shared
library, the odds of running into this bug are relatively low, but I add
a test to demonstrate the scenario and the fix for it nonetheless.

Amazingly (and scarily), this test actually passes without this change
in the default configuration -- and only fails with
-gsimple-template-names. The reason for that is that in the
non-simplified case we create a regular CXXRecordDecl whose name is
"bar<int>" (instead of a template record "foo" with an argument of
"int"). When evaluating the expression, we are somehow able to replace
this with a proper template specialization decl.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list