summaryrefslogtreecommitdiff
path: root/test/Rewriter/rewrite-anonymous-union.m
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-01-11 21:17:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-01-11 21:17:32 +0000
commit97fd83a8d827400afda3c5fba0840c1f10007239 (patch)
treed8439c2f95792c134eb352a4dda065e94f6698a1 /test/Rewriter/rewrite-anonymous-union.m
parentc027e54d669b8217a4c466f83aebee1a7c2c2e63 (diff)
downloadclang-97fd83a8d827400afda3c5fba0840c1f10007239.tar.gz
Fix a problem related to rewrite of anonymous unions.
(fixes radar 6948022) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Rewriter/rewrite-anonymous-union.m')
-rw-r--r--test/Rewriter/rewrite-anonymous-union.m30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Rewriter/rewrite-anonymous-union.m b/test/Rewriter/rewrite-anonymous-union.m
new file mode 100644
index 0000000000..579a06854f
--- /dev/null
+++ b/test/Rewriter/rewrite-anonymous-union.m
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -rewrite-objc -o - %s
+// rdar://6948022
+
+typedef unsigned int uint32_t;
+
+typedef struct {
+ union {
+ uint32_t daysOfWeek;
+ uint32_t dayOfMonth;
+ };
+ uint32_t nthOccurrence;
+} OSPatternSpecificData;
+
+@interface NSNumber
++ (NSNumber *)numberWithLong:(long)value;
+@end
+
+@interface OSRecurrence {
+ OSPatternSpecificData _pts;
+}
+- (void)_setTypeSpecificInfoOnRecord;
+@end
+
+@implementation OSRecurrence
+- (void)_setTypeSpecificInfoOnRecord
+{
+ [NSNumber numberWithLong:(_pts.dayOfMonth >= 31 ? -1 : _pts.dayOfMonth)];
+}
+@end
+