- Ping

Begin forwarded message:

From: jahanian <[email protected]>
Subject: [PATCH] Please review this arc regression in an c++11 code
Date: March 12, 2014 at 4:46:11 PM PDT
To: llvm cfe <[email protected]>

Due to change to AST for initialization of c++11’s data members by addition of 
CXXDefaultInitExpr node to the initializer _expression_, it has broken our
treatment of arc code for such initializations.
 
John, please review.

- Thanks, Fariborz

Index: lib/CodeGen/CGDecl.cpp
===================================================================
--- lib/CodeGen/CGDecl.cpp      (revision 203692)
+++ lib/CodeGen/CGDecl.cpp      (working copy)
@@ -571,7 +571,10 @@
     EmitStoreThroughLValue(RValue::get(value), lvalue, true);
     return;
   }
-
+  
+  if (const CXXDefaultInitExpr *DIE = dyn_cast<CXXDefaultInitExpr>(init))
+    init = DIE->getExpr();
+    
   // If we're emitting a value with lifetime, we have to do the
   // initialization *before* we leave the cleanup scopes.
   if (const ExprWithCleanups *ewc = dyn_cast<ExprWithCleanups>(init)) {
Index: test/CodeGenObjCXX/arc-cxx11-member-init.mm
===================================================================
--- test/CodeGenObjCXX/arc-cxx11-member-init.mm (revision 0)
+++ test/CodeGenObjCXX/arc-cxx11-member-init.mm (working copy)
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1  -triple x86_64-apple-darwin10 -fobjc-arc -std=c++11 
-emit-llvm -o - %s | FileCheck %s
+// rdar://16299964
+  
+@interface NSObject
++ (id)new;
+@end
+
+@interface NSMutableDictionary : NSObject
+@end
+  
+class XClipboardDataSet
+{ 
+  NSMutableDictionary* mClipData = [NSMutableDictionary new];
+};
+  
+@interface AppDelegate @end
+
+@implementation AppDelegate
+- (void)applicationDidFinishLaunching
+{ 
+ XClipboardDataSet clip; 
+}
+@end
+
+// CHECK: [[mClipData:%.*]] = getelementptr inbounds %class.XClipboardDataSet* 
+// CHECK: [[ZERO:%.*]] = load %struct._class_t** 
@"\01L_OBJC_CLASSLIST_REFERENCES_$_"
+// CHECK: [[ONE:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_"
+// CHECK: [[TWO:%.*]] = bitcast %struct._class_t* [[ZERO]] to i8*
+// CHECK: [[CALL:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend 
to i8* (i8*, i8*)*)(i8* [[TWO]], i8* [[ONE]])
+// CHECK: [[THREE:%.*]] = bitcast i8* [[CALL]] to [[T:%.*]]*
+// CHECK: store [[T]]* [[THREE]], [[T]]** [[mClipData]], align 8
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to