[llvm] Fix llvm::StripTemplateParameters to not return an empty name. (PR #157553)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 9 07:24:56 PDT 2025
================
@@ -299,4 +299,18 @@ TEST(DWARFDebugNames, UnsupportedForm) {
Sections,
FailedWithMessage("unsupported Form for YAML debug_names emitter"));
}
+
+TEST(DWARFDebugNames, TestStripTemplateParameters) {
+
+ std::optional<StringRef> stripped_name;
+ // Make sure we can extract the name "foo" from the template parameters.
+ stripped_name = StripTemplateParameters("foo<int>");
+ ASSERT_TRUE(stripped_name.has_value());
+ ASSERT_EQ(*stripped_name, StringRef("foo"));
+ // Make sure that we don't get an empty name back when the string starts with
----------------
felipepiovezan wrote:
the comment says "we DON'T get an empty name", but the assert seems to be the opposite?
https://github.com/llvm/llvm-project/pull/157553
More information about the llvm-commits
mailing list