Skip to content

Commit 6fb9439

Browse files
author
Fariborz Jahanian
committed
Implement encoding of methods which have instantiated
template arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103221 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent abfe192 commit 6fb9439

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

lib/AST/ASTContext.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -3593,6 +3593,17 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
35933593
// Anonymous structures print as '?'
35943594
if (const IdentifierInfo *II = RDecl->getIdentifier()) {
35953595
S += II->getName();
3596+
if (ClassTemplateSpecializationDecl *Spec
3597+
= dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
3598+
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
3599+
std::string TemplateArgsStr
3600+
= TemplateSpecializationType::PrintTemplateArgumentList(
3601+
TemplateArgs.getFlatArgumentList(),
3602+
TemplateArgs.flat_size(),
3603+
(*this).PrintingPolicy);
3604+
3605+
S += TemplateArgsStr;
3606+
}
35963607
} else {
35973608
S += '?';
35983609
}

test/CodeGenObjCXX/encode.mm

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2+
3+
// CHECK: v17@0:8{vector<float, float, float>=}16
4+
// CHECK: {vector<float, float, float>=}
5+
6+
7+
template <typename T1, typename T2, typename T3> struct vector {
8+
vector(T1,T2,T3);
9+
};
10+
11+
typedef vector< float, float, float > vector3f;
12+
13+
@interface SceneNode
14+
{
15+
vector3f position;
16+
}
17+
18+
@property (assign, nonatomic) vector3f position;
19+
20+
@end
21+
22+
@interface MyOpenGLView
23+
{
24+
@public
25+
vector3f position;
26+
}
27+
@property vector3f position;
28+
@end
29+
30+
@implementation MyOpenGLView
31+
32+
@synthesize position;
33+
34+
-(void)awakeFromNib {
35+
SceneNode *sn;
36+
vector3f VF3(1.0, 1.0, 1.0);
37+
[sn setPosition:VF3];
38+
}
39+
@end

0 commit comments

Comments
 (0)