diff --git a/src/lib/Support/LegibleNames.cpp b/src/lib/Support/LegibleNames.cpp index bbe83b7db..c0cde8593 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 && !t.ShadowDeclarations.empty()) + { + return getRawUnqualified(t.ShadowDeclarations.front()); + } + } return t.Name; }); } 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. + + + + + + +