зеркало из https://github.com/microsoft/clang-1.git
Add encoding of reference types like gcc does for objc methods and
blocks. Fixes PR6468. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
709210feee
Коммит
aa1d76163e
|
@ -3494,13 +3494,18 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// encoding for pointer or r3eference types.
|
||||||
|
QualType PointeeTy;
|
||||||
if (const PointerType *PT = T->getAs<PointerType>()) {
|
if (const PointerType *PT = T->getAs<PointerType>()) {
|
||||||
if (PT->isObjCSelType()) {
|
if (PT->isObjCSelType()) {
|
||||||
S += ':';
|
S += ':';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QualType PointeeTy = PT->getPointeeType();
|
PointeeTy = PT->getPointeeType();
|
||||||
|
}
|
||||||
|
else if (const ReferenceType *RT = T->getAs<ReferenceType>())
|
||||||
|
PointeeTy = RT->getPointeeType();
|
||||||
|
if (!PointeeTy.isNull()) {
|
||||||
bool isReadOnly = false;
|
bool isReadOnly = false;
|
||||||
// For historical/compatibility reasons, the read-only qualifier of the
|
// For historical/compatibility reasons, the read-only qualifier of the
|
||||||
// pointee gets emitted _before_ the '^'. The read-only qualifier of
|
// pointee gets emitted _before_ the '^'. The read-only qualifier of
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// RUN: %clang_cc1 -fblocks %s -emit-llvm
|
||||||
|
|
||||||
|
extern "C" int printf(const char*, ...);
|
||||||
|
|
||||||
|
template<typename T> class range {
|
||||||
|
public:
|
||||||
|
T _i;
|
||||||
|
range(T i) {_i = i;};
|
||||||
|
T get() {return _i;};
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
// works
|
||||||
|
void (^bl)(range<int> ) = ^(range<int> i){printf("Hello Blocks %d\n", i.get()); };
|
||||||
|
|
||||||
|
//crashes in godegen?
|
||||||
|
void (^bl2)(range<int>& ) = ^(range<int>& i){printf("Hello Blocks %d\n", i.get()); };
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
// CHECK: @"_ZZ11+[A shared]E1a" = internal global
|
// CHECK: @"_ZZ11+[A shared]E1a" = internal global
|
||||||
// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global
|
// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global
|
||||||
|
// CHECK: v56@0:8i16i20i24i28i32i36i40i44^i48
|
||||||
|
|
||||||
@interface A
|
@interface A
|
||||||
@end
|
@end
|
||||||
|
@ -30,3 +31,14 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
// PR6468
|
||||||
|
@interface Test
|
||||||
|
- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation Test
|
||||||
|
- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i {
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче