[clang] [clang-tools-extra] [clang] improve class type sugar preservation in pointers to members (PR #130537)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 10 09:05:34 PDT 2025
================
@@ -3524,14 +3524,16 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode {
QualType PointeeType;
/// The class of which the pointee is a member. Must ultimately be a
- /// RecordType, but could be a typedef or a template parameter too.
- const Type *Class;
+ /// CXXRecordType, but could be a typedef or a template parameter too.
+ NestedNameSpecifier *Qualifier;
----------------
mizvekov wrote:
Note that we use the 'Qualifier' name consistently to refer to the NestedNameSpecifier, including the 'getQualifier' accessor, and this goes across not only Types (ElaboratedType, DependentNameType, DependentTemplateSpecialziationType), as well as expressions (DeclRefExpr), and even TemplateName, as well (QualifiedTemplateName).
A simple `git grep getQualifier clang/include/` will show that in fact most hits are for the NestedNameSpecifier, and the Type qualifiers are in the minority.
We even have generic functions which are templated on the node and assume the 'getQualifier' spelling works across the board.
In any case, a patch to change this consistently would be massive on it's own.
https://github.com/llvm/llvm-project/pull/130537
More information about the cfe-commits
mailing list