From 9c1cca91be05e4efcc8e885d5d996f14eff0e661 Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Thu, 11 Sep 2025 15:31:42 +0200 Subject: [PATCH 1/3] fix --- src/lib/Support/LegibleNames.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/Support/LegibleNames.cpp b/src/lib/Support/LegibleNames.cpp index bbe83b7db..f21a450ad 100644 --- a/src/lib/Support/LegibleNames.cpp +++ b/src/lib/Support/LegibleNames.cpp @@ -225,6 +225,13 @@ class LegibleNames::Impl return getUnnamedInfoName(t); } } + else if constexpr(T::isUsing()) + { + if (t.Class == UsingClass::Normal) + { + return getUnnamedInfoName(t); + } + } return t.Name; }); } From bd200166d9f02a7db071cd3fe6b9456e1eded333 Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Thu, 11 Sep 2025 15:56:11 +0200 Subject: [PATCH 2/3] preserve name --- src/lib/Support/LegibleNames.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Support/LegibleNames.cpp b/src/lib/Support/LegibleNames.cpp index f21a450ad..c0cde8593 100644 --- a/src/lib/Support/LegibleNames.cpp +++ b/src/lib/Support/LegibleNames.cpp @@ -227,9 +227,9 @@ class LegibleNames::Impl } else if constexpr(T::isUsing()) { - if (t.Class == UsingClass::Normal) + if (t.Class == UsingClass::Normal && !t.ShadowDeclarations.empty()) { - return getUnnamedInfoName(t); + return getRawUnqualified(t.ShadowDeclarations.front()); } } return t.Name; From ddc03b7ae0537cfc20588b011ead986d4ad5a40b Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Thu, 11 Sep 2025 16:26:09 +0200 Subject: [PATCH 3/3] add test --- .../using/using-member-conversion.adoc | 156 ++++++++++++ .../symbols/using/using-member-conversion.cpp | 16 ++ .../using/using-member-conversion.html | 228 ++++++++++++++++++ .../symbols/using/using-member-conversion.xml | 77 ++++++ 4 files changed, 477 insertions(+) create mode 100644 test-files/golden-tests/symbols/using/using-member-conversion.adoc create mode 100644 test-files/golden-tests/symbols/using/using-member-conversion.cpp create mode 100644 test-files/golden-tests/symbols/using/using-member-conversion.html create mode 100644 test-files/golden-tests/symbols/using/using-member-conversion.xml diff --git a/test-files/golden-tests/symbols/using/using-member-conversion.adoc b/test-files/golden-tests/symbols/using/using-member-conversion.adoc new file mode 100644 index 000000000..a7f80d828 --- /dev/null +++ b/test-files/golden-tests/symbols/using/using-member-conversion.adoc @@ -0,0 +1,156 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Types + +[cols=2] +|=== +| Name +| Description +| link:#X[`X`] +| This struct will be inherited as public +| link:#Y[`Y`] +| This struct inherits from X +| link:#fun_ptr[`fun_ptr`] +| A pointer to function typedef +|=== + +[#fun_ptr] +== fun_ptr + +A pointer to function typedef + +=== Synopsis + +Declared in `<using‐member‐conversion.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using fun_ptr = void(*)(); +---- + +[#X] +== X + +This struct will be inherited as public + +=== Synopsis + +Declared in `<using‐member‐conversion.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +struct X; +---- + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| link:#X-2conversion[`operator fun_ptr`] +| Conversion operator to function pointer. +|=== + +=== Derived Classes + +[cols=2] +|=== +| Name +| Description +| link:#Y[`Y`] +| This struct inherits from X +|=== + +[#X-2conversion] +== link:#X[X]::operator link:#fun_ptr[fun_ptr] + +Conversion operator to function pointer. + +=== Synopsis + +Declared in `<using‐member‐conversion.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +operator link:#fun_ptr[fun_ptr]() const; +---- + +=== Return Value + +A pointer to function typedef + +[#Y] +== Y + +This struct inherits from X + +=== Synopsis + +Declared in `<using‐member‐conversion.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +struct Y + : link:#X[X] +---- + +=== Base Classes + +[cols=2] +|=== +| Name +| Description +| `link:#X[X]` +| This struct will be inherited as public +|=== + +=== Member Functions + +[cols=2] +|=== +| Name +| Description +| link:#X-2conversion[`operator fun_ptr`] +| Conversion operator to function pointer. +|=== + +=== Using Declarations + +[cols=2] +|=== +| Name +| Description +| link:#Y-2conversion[`operator void(*)()`] +| Bring X::operator fun_ptr into Y. +|=== + +[#Y-2conversion] +== link:#Y[Y]::operator void(*)() + +Bring X::operator fun_ptr into Y. + +=== Synopsis + +Declared in `<using‐member‐conversion.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using X::operator void(*)(); +---- + +=== Introduced Symbols + +[cols=2] +|=== +| Name +| Description +| link:#X-2conversion[X::operator fun_ptr] +| Conversion operator to function pointer. +|=== + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/symbols/using/using-member-conversion.cpp b/test-files/golden-tests/symbols/using/using-member-conversion.cpp new file mode 100644 index 000000000..6e3cd19f1 --- /dev/null +++ b/test-files/golden-tests/symbols/using/using-member-conversion.cpp @@ -0,0 +1,16 @@ +/// A pointer to function typedef +using fun_ptr = void (*)(); + +/// This struct will be inherited as public +struct X +{ + /// Conversion operator to function pointer. + operator fun_ptr() const; +}; + +/// This struct inherits from X +struct Y : X +{ + /// Bring X::operator fun_ptr into Y. + using X::operator fun_ptr; +}; diff --git a/test-files/golden-tests/symbols/using/using-member-conversion.html b/test-files/golden-tests/symbols/using/using-member-conversion.html new file mode 100644 index 000000000..b82eeab5b --- /dev/null +++ b/test-files/golden-tests/symbols/using/using-member-conversion.html @@ -0,0 +1,228 @@ + + +Reference + + +
+

Reference

+
+
+

+
+

Types

+ + + + + + + + + + + + + +
NameDescription
X This struct will be inherited as public
Y This struct inherits from X
fun_ptr A pointer to function typedef
+ +
+
+
+

fun_ptr

+
+A pointer to function typedef + +
+
+
+

Synopsis

+
+Declared in <using-member-conversion.cpp>
+
+using fun_ptr = void(*)();
+
+
+
+
+
+
+
+

X

+
+This struct will be inherited as public + +
+
+
+

Synopsis

+
+Declared in <using-member-conversion.cpp>
+
+struct X;
+
+
+
+
+

Member Functions

+ + + + + + + + + + + +
NameDescription
operator fun_ptr Conversion operator to function pointer.
+ + + +
+

Derived Classes

+ + + + + + + + + + +
NameDescription
Y + This struct inherits from X
+
+
+
+
+

X::operator fun_ptr

+
+Conversion operator to function pointer. + +
+
+
+

Synopsis

+
+Declared in <using-member-conversion.cpp>
+
+operator fun_ptr() const;
+
+
+
+
+
+

Return Value

+A pointer to function typedef +
+
+
+
+

Y

+
+This struct inherits from X + +
+
+
+

Synopsis

+
+Declared in <using-member-conversion.cpp>
+
+struct Y
+    : X
+
+
+
+
+
+

Base Classes

+ + + + + + + + + + +
NameDescription
XThis struct will be inherited as public
+
+

Member Functions

+ + + + + + + + + + + +
NameDescription
operator fun_ptr Conversion operator to function pointer.
+ +

Using Declarations

+ + + + + + + + + + + +
NameDescription
operator void(*)() Bring X::operator fun_ptr into Y.
+ + + +
+
+
+

Y::operator void(*)()

+
+Bring X::operator fun_ptr into Y. + +
+
+
+

Synopsis

+
+Declared in <using-member-conversion.cpp>
+
+using X::operator void(*)();
+
+
+
+
+
+

Introduced Symbols

+ + + + + + + + + + + + + +
NameDescription
X::operator fun_ptrConversion operator to function pointer.
+
+ +
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/symbols/using/using-member-conversion.xml b/test-files/golden-tests/symbols/using/using-member-conversion.xml new file mode 100644 index 000000000..0a947914a --- /dev/null +++ b/test-files/golden-tests/symbols/using/using-member-conversion.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + A pointer to function typedef + + + + + + + + This struct will be inherited as public + + + + + + + + + + + Conversion operator to function pointer. + + + A pointer to function typedef + + + + + + + + + + + + This struct inherits from X + + + + + + + + + + + Conversion operator to function pointer. + + + A pointer to function typedef + + + + + + + + Bring X::operator fun_ptr into Y. + + + + + + +