[cfe-commits] r145776 - in /cfe/trunk: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle-address-space.cpp
Douglas Gregor
dgregor at apple.com
Sat Dec 3 10:24:44 PST 2011
Author: dgregor
Date: Sat Dec 3 12:24:43 2011
New Revision: 145776
URL: http://llvm.org/viewvc/llvm-project?rev=145776&view=rev
Log:
Fix mangling substitutions for address-space-qualified class
types. Patch from Dmitri Rubinstein!
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-address-space.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=145776&r1=145775&r2=145776&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Sat Dec 3 12:24:43 2011
@@ -2984,8 +2984,15 @@
return mangleSubstitution(reinterpret_cast<uintptr_t>(ND));
}
+/// \brief Determine whether the given type has any qualifiers that are
+/// relevant for substitutions.
+static bool hasMangledSubstitutionQualifiers(QualType T) {
+ Qualifiers Qs = T.getQualifiers();
+ return Qs.getCVRQualifiers() || Qs.hasAddressSpace();
+}
+
bool CXXNameMangler::mangleSubstitution(QualType T) {
- if (!T.getCVRQualifiers()) {
+ if (!hasMangledSubstitutionQualifiers(T)) {
if (const RecordType *RT = T->getAs<RecordType>())
return mangleSubstitution(RT->getDecl());
}
@@ -3171,7 +3178,7 @@
}
void CXXNameMangler::addSubstitution(QualType T) {
- if (!T.getCVRQualifiers()) {
+ if (!hasMangledSubstitutionQualifiers(T)) {
if (const RecordType *RT = T->getAs<RecordType>()) {
addSubstitution(RT->getDecl());
return;
Modified: cfe/trunk/test/CodeGenCXX/mangle-address-space.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-address-space.cpp?rev=145776&r1=145775&r2=145776&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-address-space.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-address-space.cpp Sat Dec 3 12:24:43 2011
@@ -4,3 +4,9 @@
void f0(char *p) { }
// CHECK: define void @_Z2f0PU3AS1c
void f0(char __attribute__((address_space(1))) *p) { }
+
+struct OpaqueType;
+typedef OpaqueType __attribute__((address_space(100))) * OpaqueTypePtr;
+
+// CHECK: define void @_Z2f0PU5AS10010OpaqueType
+void f0(OpaqueTypePtr) { }
More information about the cfe-commits
mailing list