aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-03-20 10:30:24 -0300
committerGitHub <noreply@github.com>2025-03-20 10:30:24 -0300
commit9b1f905b483a2b42e4681bbef42b2641f8ccf5ad (patch)
treebdd4b29db08e95dc264b850e636318ce7524f561 /clang/lib/CodeGen/CodeGenModule.cpp
parentcb1e91c18dd20f6b2d1c38ce93befab87f77ce0f (diff)
downloadllvm-9b1f905b483a2b42e4681bbef42b2641f8ccf5ad.zip
llvm-9b1f905b483a2b42e4681bbef42b2641f8ccf5ad.tar.gz
llvm-9b1f905b483a2b42e4681bbef42b2641f8ccf5ad.tar.bz2
[clang] improve class type sugar preservation in pointers to members (#130537)
This changes the MemberPointerType representation to use a NestedNameSpecifier instead of a Type to represent the class. Since the qualifiers are always parsed as nested names, there was an impedance mismatch when converting these back and forth into types, and this led to issues in preserving sugar. The nested names are indeed a better match for these, as the differences which a QualType can represent cannot be expressed syntactically, and it also represents the use case more exactly, being either dependent or referring to a CXXRecord, unqualified. This patch also makes the MemberPointerType able to represent sugar for a {up/downcast}cast conversion of the base class, although for now the underlying type is canonical, as preserving the sugar up to that point requires further work. As usual, includes a few drive-by fixes in order to make use of the improvements, and removing some duplications, for example CheckBaseClassAccess is deduplicated from across SemaAccess and SemaCast.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f88d620..e26c6c3 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2667,7 +2667,7 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
for (const CXXRecordDecl *Base : getMostBaseClasses(MD->getParent())) {
llvm::Metadata *Id =
CreateMetadataIdentifierForType(Context.getMemberPointerType(
- MD->getType(), Context.getRecordType(Base).getTypePtr()));
+ MD->getType(), /*Qualifier=*/nullptr, Base));
F->addTypeMetadata(0, Id);
}
}