[llvm-commits] [llvm-gcc-4.2] r102433 - in /llvm-gcc-4.2/trunk/gcc: c-typeck.c cp/typeck.c objc/objc-act.c
Stuart Hastings
stuart at apple.com
Tue Apr 27 08:50:02 PDT 2010
Author: stuart
Date: Tue Apr 27 10:50:02 2010
New Revision: 102433
URL: http://llvm.org/viewvc/llvm-project?rev=102433&view=rev
Log:
Diagnose illegal ivar accesses in blocks. Radar 7901648. Patch by Fariborz Jahanian!
Modified:
llvm-gcc-4.2/trunk/gcc/c-typeck.c
llvm-gcc-4.2/trunk/gcc/cp/typeck.c
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=102433&r1=102432&r2=102433&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Tue Apr 27 10:50:02 2010
@@ -7790,6 +7790,10 @@
c_finish_block_return_stmt (tree retval)
{
tree valtype;
+ /* APPLE LOCAL begin radar 7901648 */
+ if (retval == error_mark_node)
+ return error_mark_node;
+ /* APPLE LOCAL end radar 7901648 */
/* If this is the first return we've seen in the block, infer the type of
the block from it. */
if (cur_block->return_type == NULL_TREE)
Modified: llvm-gcc-4.2/trunk/gcc/cp/typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/typeck.c?rev=102433&r1=102432&r2=102433&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Tue Apr 27 10:50:02 2010
@@ -7063,6 +7063,11 @@
/* APPLE LOCAL radar 6185344 */
if (cur_block && !cur_block->block_has_return_type)
{
+ /* APPLE LOCAL begin radar 7901648 */
+ if (retval == error_mark_node ||
+ retval && TREE_TYPE(retval) == error_mark_node)
+ return error_mark_node;
+ /* APPLE LOCAL end radar 7901648 */
/* If this is the first return we've seen in the block, infer the type of
the block from it. */
if (cur_block->return_type == NULL_TREE)
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=102433&r1=102432&r2=102433&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Apr 27 10:50:02 2010
@@ -14642,9 +14642,16 @@
to an instance variable. It's better to catch the cases
where this is done unknowingly than to support the above
paradigm. */
+ /* APPLE LOCAL begin radar 7901648 */
+ if (cur_block) {
+ error ("instance variable %qs accessed in class method",
+ IDENTIFIER_POINTER (id));
+ return error_mark_node;
+ }
warning (0, "instance variable %qs accessed in class method",
- IDENTIFIER_POINTER (id));
+ IDENTIFIER_POINTER (id));
self_decl = convert (objc_instance_type, self_decl); /* cast */
+ /* APPLE LOCAL end radar 7901648 */
}
/* APPLE LOCAL begin ObjC new abi */
More information about the llvm-commits
mailing list