aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-05-07 00:28:49 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-05-07 00:28:49 +0000
commit6fb94391dc7cb11fd4bbdb969bbab11b6b48c223 (patch)
tree7f9ea96f9295edf3c4534f99797a52b3f7bc44ff
parentabfe1925e7cb0fbc36944f376b0695a68eebb455 (diff)
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
-rw-r--r--lib/AST/ASTContext.cpp11
-rw-r--r--test/CodeGenObjCXX/encode.mm39
2 files changed, 50 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index eea727deb4..141f1b9bf9 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -3593,6 +3593,17 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
// Anonymous structures print as '?'
if (const IdentifierInfo *II = RDecl->getIdentifier()) {
S += II->getName();
+ if (ClassTemplateSpecializationDecl *Spec
+ = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
+ const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
+ std::string TemplateArgsStr
+ = TemplateSpecializationType::PrintTemplateArgumentList(
+ TemplateArgs.getFlatArgumentList(),
+ TemplateArgs.flat_size(),
+ (*this).PrintingPolicy);
+
+ S += TemplateArgsStr;
+ }
} else {
S += '?';
}
diff --git a/test/CodeGenObjCXX/encode.mm b/test/CodeGenObjCXX/encode.mm
new file mode 100644
index 0000000000..9dfd14db05
--- /dev/null
+++ b/test/CodeGenObjCXX/encode.mm
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: v17@0:8{vector<float, float, float>=}16
+// CHECK: {vector<float, float, float>=}
+
+
+template <typename T1, typename T2, typename T3> struct vector {
+ vector(T1,T2,T3);
+};
+
+typedef vector< float, float, float > vector3f;
+
+@interface SceneNode
+{
+ vector3f position;
+}
+
+@property (assign, nonatomic) vector3f position;
+
+@end
+
+@interface MyOpenGLView
+{
+@public
+ vector3f position;
+}
+@property vector3f position;
+@end
+
+@implementation MyOpenGLView
+
+@synthesize position;
+
+-(void)awakeFromNib {
+ SceneNode *sn;
+ vector3f VF3(1.0, 1.0, 1.0);
+ [sn setPosition:VF3];
+}
+@end