r174729 - objective-C modern translation: Fix another random translation bug
Fariborz Jahanian
fjahanian at apple.com
Fri Feb 8 10:57:51 PST 2013
Author: fjahanian
Date: Fri Feb 8 12:57:50 2013
New Revision: 174729
URL: http://llvm.org/viewvc/llvm-project?rev=174729&view=rev
Log:
objective-C modern translation: Fix another random translation bug
involving property getter expressions on rhs of property setter.
// rdar://13138459
Added:
cfe/trunk/test/Rewriter/objc-modern-property-bitfield.m
Modified:
cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp
Modified: cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp?rev=174729&r1=174728&r2=174729&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp Fri Feb 8 12:57:50 2013
@@ -5660,6 +5660,8 @@ Stmt *RewriteModernObjC::RewriteFunction
} else if (ObjCIvarRefExpr *IvarRefExpr = dyn_cast<ObjCIvarRefExpr>(S)) {
return RewriteObjCIvarRefExpr(IvarRefExpr);
}
+ else if (isa<OpaqueValueExpr>(S))
+ S = cast<OpaqueValueExpr>(S)->getSourceExpr();
SourceRange OrigStmtRange = S->getSourceRange();
Added: cfe/trunk/test/Rewriter/objc-modern-property-bitfield.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/objc-modern-property-bitfield.m?rev=174729&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/objc-modern-property-bitfield.m (added)
+++ cfe/trunk/test/Rewriter/objc-modern-property-bitfield.m Fri Feb 8 12:57:50 2013
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
+// rdar://13138459
+
+void *sel_registerName(const char *);
+extern void abort();
+
+ at interface NSObject
++ alloc;
+- init;
+ at end
+
+typedef unsigned char BOOL;
+
+ at interface Foo : NSObject {
+
+ BOOL _field1 : 5;
+ BOOL _field2 : 3;
+}
+
+ at property BOOL field1;
+ at property BOOL field2;
+ at end
+
+ at implementation Foo
+
+ at synthesize field1 = _field1;
+ at synthesize field2 = _field2;
+
+ at end
+
+int main()
+{
+ Foo *f = (Foo*)[[Foo alloc] init];
+ f.field1 = 0xF;
+ f.field2 = 0x3;
+ f.field1 = f.field1 & f.field2;
+ if (f.field1 != 0x3)
+ abort ();
+ return 0;
+}
+
+
More information about the cfe-commits
mailing list