diff options
author | David Blaikie <dblaikie@gmail.com> | 2022-02-10 14:40:25 -0800 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2022-02-10 14:56:54 -0800 |
commit | f3a2cfc10394143bbe30a6af00be8b68c1c0d607 (patch) | |
tree | 34b670b4b9a29cfbec2b21374879fad87f015893 /cross-project-tests | |
parent | 37c02c14a42a8b8aae4e868ef5aa29a5005b863d (diff) | |
download | llvm-f3a2cfc10394143bbe30a6af00be8b68c1c0d607.tar.gz |
DebugInfo: Don't simplify any template referencing a lambda
Lambda names aren't entirely canonical (as demonstrated by the
cross-project-test added here) at the moment (we should fix that for a
bunch of reasons) - even if the template referencing them is
non-simplified, other names referencing /that/ template can't be
simplified either because type units might cause a different template to
be picked up that would conflict with the expected name.
(other than for roundtripping precision, it'd be OK to simplify types
that reference types that reference lambdas - but best be consistent
between the roundtrip/verify mode and the actual simplified template
names mode)
Diffstat (limited to 'cross-project-tests')
2 files changed, 41 insertions, 0 deletions
diff --git a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp index 61ac76db832c..d608039959df 100644 --- a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp +++ b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp @@ -216,6 +216,7 @@ int main() { f1<t3<t3<int>>>(); f1<decltype(L)>(); t3<decltype(L)> v1; + f1<t3<t3<decltype(L)>>>(); f1<int(float)>(); f1<void(...)>(); f1<void(int, ...)>(); diff --git a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names_noncanonical_type_units.cpp b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names_noncanonical_type_units.cpp new file mode 100644 index 000000000000..65c6bba6746f --- /dev/null +++ b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names_noncanonical_type_units.cpp @@ -0,0 +1,40 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: mkdir %t/incl +// RUN: mv %t/header.h %t/incl/header.h +// RUN: cd %t +// RUN: %clang %target_itanium_abi_host_triple -g -o %t/a.out \ +// RUN: -Xclang -gsimple-template-names=mangled \ +// RUN: -Xclang -debug-forward-template-params \ +// RUN: -std=c++20 -fdebug-types-section -I incl a.cpp b.cpp +// RUN: llvm-dwarfdump --verify %t/a.out + +//--- header.h +template <typename T> struct t1 {}; +inline auto f1() { + auto T = [] {}; + t1<decltype(T)> v; + return v; +} +inline auto f2() { + struct { + } T; + t1<decltype(T)> v; + return v; +} +void a(); +//--- a.cpp +#include "incl/header.h" +template <typename T> void ft() {} +void a() { + ft<decltype(f1())>(); + ft<decltype(f2())>(); +} +//--- b.cpp +#include "header.h" +template <typename T> void ft() {} +int main() { + a(); + ft<decltype(f1())>(); + ft<decltype(f2())>(); +} |