[cfe-commits] r103221 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjCXX/encode.mm

Fariborz Jahanian fjahanian at apple.com
Thu May 6 17:28:49 PDT 2010


Author: fjahanian
Date: Thu May  6 19:28:49 2010
New Revision: 103221

URL: http://llvm.org/viewvc/llvm-project?rev=103221&view=rev
Log:
Implement encoding of methods which have instantiated
template arguments.


Added:
    cfe/trunk/test/CodeGenObjCXX/encode.mm
Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=103221&r1=103220&r2=103221&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu May  6 19:28:49 2010
@@ -3593,6 +3593,17 @@
     // 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 += '?';
     }

Added: cfe/trunk/test/CodeGenObjCXX/encode.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/encode.mm?rev=103221&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/encode.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/encode.mm Thu May  6 19:28:49 2010
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: v17 at 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;
+
+ at interface SceneNode
+{
+ vector3f position;
+}
+
+ at property (assign, nonatomic) vector3f position;
+
+ at end
+
+ at interface MyOpenGLView
+{
+ at public
+  vector3f position;
+}
+ at property vector3f position;
+ at end
+
+ at implementation MyOpenGLView
+
+ at synthesize position;
+
+-(void)awakeFromNib {
+ SceneNode *sn;
+ vector3f VF3(1.0, 1.0, 1.0);
+ [sn setPosition:VF3];
+}
+ at end





More information about the cfe-commits mailing list