aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-03-20 15:33:54 -0300
committerGitHub <noreply@github.com>2025-03-20 15:33:54 -0300
commit578f38cd08ba71300b013644e5ae8c8a64598800 (patch)
tree07c81d2662453f82cd2f1d69758789804a3e5a8e /clang/lib/CodeGen/CodeGenModule.cpp
parentebe5c660608c1c830236c1e379c9720292343cda (diff)
downloadllvm-578f38cd08ba71300b013644e5ae8c8a64598800.zip
llvm-578f38cd08ba71300b013644e5ae8c8a64598800.tar.gz
llvm-578f38cd08ba71300b013644e5ae8c8a64598800.tar.bz2
Reland: [clang] preserve class type sugar when taking pointer to member (#132234)
Original PR: #130537 Reland after updating lldb too. This changes the MemberPointerType representation to use a NestedNameSpecifier instead of a Type to represent the base 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 syntatically, and they represent 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.
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 2af692d..257b7b4 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);
}
}