[llvm-branch-commits] [cfe-branch] r102105 - in /cfe/branches/Apple/williamson: lib/Sema/SemaExprObjC.cpp test/SemaObjC/transparent-union.m
Daniel Dunbar
daniel at zuster.org
Thu Apr 22 11:41:07 PDT 2010
Author: ddunbar
Date: Thu Apr 22 13:41:07 2010
New Revision: 102105
URL: http://llvm.org/viewvc/llvm-project?rev=102105&view=rev
Log:
Patch to support transparent_union types on objective-c methods. Fixes radar 7875968.
Added:
cfe/branches/Apple/williamson/test/SemaObjC/transparent-union.m
Modified:
cfe/branches/Apple/williamson/lib/Sema/SemaExprObjC.cpp
Modified: cfe/branches/Apple/williamson/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Sema/SemaExprObjC.cpp?rev=102105&r1=102104&r2=102105&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Sema/SemaExprObjC.cpp Thu Apr 22 13:41:07 2010
@@ -211,6 +211,11 @@
AssignConvertType Result =
CheckSingleAssignmentConstraints(lhsType, argExpr);
+ if (Result == Incompatible && !getLangOptions().CPlusPlus &&
+ CheckTransparentUnionArgumentConstraints(lhsType, argExpr)
+ == Sema::Compatible)
+ Result = Compatible;
+
if (Args[i] != argExpr) // The expression was converted.
Args[i] = argExpr; // Make sure we store the converted expression.
Added: cfe/branches/Apple/williamson/test/SemaObjC/transparent-union.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/test/SemaObjC/transparent-union.m?rev=102105&view=auto
==============================================================================
--- cfe/branches/Apple/williamson/test/SemaObjC/transparent-union.m (added)
+++ cfe/branches/Apple/williamson/test/SemaObjC/transparent-union.m Thu Apr 22 13:41:07 2010
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef union {
+ struct xx_object_s *_do;
+ struct xx_continuation_s *_dc;
+ struct xx_queue_s *_dq;
+ struct xx_queue_attr_s *_dqa;
+ struct xx_group_s *_dg;
+ struct xx_source_s *_ds;
+ struct xx_source_attr_s *_dsa;
+ struct xx_semaphore_s *_dsema;
+} xx_object_t __attribute__((transparent_union));
+
+ at interface INTF
+- (void) doSomething : (xx_object_t) xxObject;
+- (void)testMeth;
+ at end
+
+ at implementation INTF
+- (void) doSomething : (xx_object_t) xxObject {}
+- (void)testMeth { struct xx_queue_s *sq; [self doSomething:sq ]; }
+ at end
More information about the llvm-branch-commits
mailing list