https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/170804

>From f2820166e6419f7aef8efba29398738f343dbca9 Mon Sep 17 00:00:00 2001
From: Michael Buch <[email protected]>
Date: Fri, 5 Dec 2025 14:38:46 +0800
Subject: [PATCH 1/2] [lldb][test] Add basic API tests for
 DW_TAG_template_alias

---
 .../test/API/lang/cpp/template-alias/Makefile |  3 ++
 .../cpp/template-alias/TestTemplateAlias.py   | 50 +++++++++++++++++++
 .../test/API/lang/cpp/template-alias/main.cpp | 19 +++++++
 3 files changed, 72 insertions(+)
 create mode 100644 lldb/test/API/lang/cpp/template-alias/Makefile
 create mode 100644 lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
 create mode 100644 lldb/test/API/lang/cpp/template-alias/main.cpp

diff --git a/lldb/test/API/lang/cpp/template-alias/Makefile 
b/lldb/test/API/lang/cpp/template-alias/Makefile
new file mode 100644
index 0000000000000..99998b20bcb05
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py 
b/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
new file mode 100644
index 0000000000000..b8314eb7cff08
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/TestTemplateAlias.py
@@ -0,0 +1,50 @@
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestTemplateAlias(TestBase):
+    def do_test(self, extra_flags):
+        self.build(dictionary=extra_flags)
+        self.main_source_file = lldb.SBFileSpec("main.cpp")
+        lldbutil.run_to_source_breakpoint(self, "return", 
lldb.SBFileSpec("main.cpp"))
+
+        self.expect_expr("f1", result_type="Foo<int>")
+        self.expect_expr("f2", result_type="Foo<double>")
+        self.expect_expr("b1", result_type="Bar<int>")
+        self.expect_expr("b2", result_type="Bar<double>")
+        self.expect_expr("bf1", result_type="Bar<int>")
+        self.expect_expr("bf2", result_type="Bar<double>")
+        self.expect_expr("bf1", result_type="Bar<int>")
+        self.expect_expr("bf2", result_type="Bar<double>")
+        self.expect_expr("cbf1", result_type="Container<int>")
+
+    @expectedFailureAll(
+        bugnumber="LLDB doesn't reconstruct template alias names from template 
parameters"
+    )
+    def test_tag_alias_simple(self):
+        self.do_test(
+            dict(CXXFLAGS_EXTRAS="-gdwarf-5 -gtemplate-alias 
-gsimple-template-names")
+        )
+
+    def test_tag_alias_no_simple(self):
+        self.do_test(
+            dict(
+                CXXFLAGS_EXTRAS="-gdwarf-5 -gtemplate-alias 
-gno-simple-template-names"
+            )
+        )
+
+    def test_no_tag_alias_simple(self):
+        self.do_test(
+            dict(
+                CXXFLAGS_EXTRAS="-gdwarf-5 -gno-template-alias 
-gsimple-template-names"
+            )
+        )
+
+    def test_no_tag_alias_no_simple(self):
+        self.do_test(
+            dict(
+                CXXFLAGS_EXTRAS="-gdwarf-5 -gno-template-alias 
-gno-simple-template-names"
+            )
+        )
diff --git a/lldb/test/API/lang/cpp/template-alias/main.cpp 
b/lldb/test/API/lang/cpp/template-alias/main.cpp
new file mode 100644
index 0000000000000..2a2fefe085d7a
--- /dev/null
+++ b/lldb/test/API/lang/cpp/template-alias/main.cpp
@@ -0,0 +1,19 @@
+template<typename T>
+using Foo = T;
+
+template<typename T>
+using Bar = Foo<T>;
+
+template<typename T>
+struct Container {};
+
+int main() {
+    Foo<int> f1;
+    Foo<double> f2;
+    Bar<int> b1;
+    Bar<double> b2;
+    Bar<Foo<int>> bf1;
+    Bar<Foo<double>> bf2;
+    Container<Bar<Foo<int>>> cbf1;
+    return 0;
+}

>From 6c75de31d761b78b3a2970b5f2057349d25bd3d6 Mon Sep 17 00:00:00 2001
From: Michael Buch <[email protected]>
Date: Fri, 5 Dec 2025 16:42:39 +0800
Subject: [PATCH 2/2] fixup! clang-format

---
 .../test/API/lang/cpp/template-alias/main.cpp | 25 ++++++++-----------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/lldb/test/API/lang/cpp/template-alias/main.cpp 
b/lldb/test/API/lang/cpp/template-alias/main.cpp
index 2a2fefe085d7a..af6c9792aee44 100644
--- a/lldb/test/API/lang/cpp/template-alias/main.cpp
+++ b/lldb/test/API/lang/cpp/template-alias/main.cpp
@@ -1,19 +1,16 @@
-template<typename T>
-using Foo = T;
+template <typename T> using Foo = T;
 
-template<typename T>
-using Bar = Foo<T>;
+template <typename T> using Bar = Foo<T>;
 
-template<typename T>
-struct Container {};
+template <typename T> struct Container {};
 
 int main() {
-    Foo<int> f1;
-    Foo<double> f2;
-    Bar<int> b1;
-    Bar<double> b2;
-    Bar<Foo<int>> bf1;
-    Bar<Foo<double>> bf2;
-    Container<Bar<Foo<int>>> cbf1;
-    return 0;
+  Foo<int> f1;
+  Foo<double> f2;
+  Bar<int> b1;
+  Bar<double> b2;
+  Bar<Foo<int>> bf1;
+  Bar<Foo<double>> bf2;
+  Container<Bar<Foo<int>>> cbf1;
+  return 0;
 }

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to