[llvm-commits] [llvm-gcc-4.2] r63873 - in /llvm-gcc-4.2/trunk/gcc: c-common.h c-typeck.c objc/objc-act.c stub-objc.c

Chris Lattner sabre at nondot.org
Thu Feb 5 10:14:58 PST 2009


Author: lattner
Date: Thu Feb  5 12:14:58 2009
New Revision: 63873

URL: http://llvm.org/viewvc/llvm-project?rev=63873&view=rev
Log:
Fix rdar://6551276, a bogus warning being emitted because volatile is
being propagated without the matching 'objc_volatilized' attribute, used
by the objc front-end with @try.  Testcase here:
llvm/test/FrontendObjC/2009-02-05-VolatileProp.m


Modified:
    llvm-gcc-4.2/trunk/gcc/c-common.h
    llvm-gcc-4.2/trunk/gcc/c-typeck.c
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
    llvm-gcc-4.2/trunk/gcc/stub-objc.c

Modified: llvm-gcc-4.2/trunk/gcc/c-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.h?rev=63873&r1=63872&r2=63873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.h Thu Feb  5 12:14:58 2009
@@ -993,6 +993,8 @@
 /* APPLE LOCAL radar 4507230 */
 bool objc_type_valid_for_messaging (tree);
 extern void objc_volatilize_decl (tree);
+/* LLVM LOCAL rdar 6551276 */
+extern tree objc_build_volatilized_type (tree);
 extern bool objc_type_quals_match (tree, tree);
 extern tree objc_rewrite_function_call (tree, tree);
 extern tree objc_message_selector (void);

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=63873&r1=63872&r2=63873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Thu Feb  5 12:14:58 2009
@@ -2081,6 +2081,13 @@
       if (TREE_CODE (type) != ARRAY_TYPE && !objc_is_object_ptr (type))
       /* APPLE LOCAL end radar 6164211 */
 	type = TYPE_MAIN_VARIANT (type);
+      
+      /* LLVM LOCAL begin propagate objc_volatilized: rdar://6551276 */
+      if (lookup_attribute ("objc_volatilized", 
+                            TYPE_ATTRIBUTES (TREE_TYPE (TREE_TYPE (array)))))
+        type = objc_build_volatilized_type(type);
+      /* LLVM LOCAL end propagate objc_volatilized: rdar://6551276 */
+      
       rval = build4 (ARRAY_REF, type, array, index, NULL_TREE, NULL_TREE);
       /* Array ref is const/volatile if the array elements are
 	 or if the array is.  */
@@ -2097,6 +2104,7 @@
 	       in an inline function.
 	       Hope it doesn't break something else.  */
 	    | TREE_THIS_VOLATILE (array));
+
       return require_complete_type (fold (rval));
     }
   else

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=63873&r1=63872&r2=63873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Feb  5 12:14:58 2009
@@ -3452,7 +3452,8 @@
 /* Build a type differing from TYPE only in that TYPE_VOLATILE is set.
    Unlike tree.c:build_qualified_type(), preserve TYPE_LANG_SPECIFIC in the
    process.  */
-static tree
+/* LLVM LOCAL rdar 6551276 */
+tree
 objc_build_volatilized_type (tree type)
 {
   tree t;

Modified: llvm-gcc-4.2/trunk/gcc/stub-objc.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stub-objc.c?rev=63873&r1=63872&r2=63873&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/stub-objc.c (original)
+++ llvm-gcc-4.2/trunk/gcc/stub-objc.c Thu Feb  5 12:14:58 2009
@@ -79,6 +79,14 @@
 }
 /* APPLE LOCAL end radar 4330422 */
 
+/* LLVM LOCAL begin radar 6551276 */
+tree
+objc_build_volatilized_type (tree type)
+{
+  return type;
+}
+/* LLVM LOCAL end radar 6551276 */
+
 /* APPLE LOCAL begin radar 4697411 */
 void
 objc_volatilize_component_ref (tree ARG_UNUSED (cref), tree ARG_UNUSED (type))





More information about the llvm-commits mailing list