[clang] [clang-tools-extra] [clang] improve class type sugar preservation in pointers to members (PR #130537)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 10 08:02:29 PDT 2025


================
@@ -4024,32 +4026,50 @@ QualType ASTContext::getRValueReferenceType(QualType T) const {
   return QualType(New, 0);
 }
 
-/// getMemberPointerType - Return the uniqued reference to the type for a
-/// member pointer to the specified type, in the specified class.
-QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls) const {
+QualType ASTContext::getMemberPointerType(QualType T,
+                                          NestedNameSpecifier *Qualifier,
+                                          const CXXRecordDecl *Cls) const {
+  if (!Qualifier) {
+    assert(Cls && "At least one of Qualifier or Cls must be provided");
+    Qualifier = NestedNameSpecifier::Create(*this, /*Prefix=*/nullptr,
+                                            /*Template=*/false,
+                                            getTypeDeclType(Cls).getTypePtr());
+  } else if (!Cls) {
+    Cls = Qualifier->getAsRecordDecl();
----------------
erichkeane wrote:

By this point I'm even more in hate with the use of `qualifier`.  I'm mentally thinking `Const-volatile/etc` every single time...

https://github.com/llvm/llvm-project/pull/130537


More information about the cfe-commits mailing list