[cfe-commits] r72683 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaObjC/objc2-merge-gc-attribue-decl.m

Fariborz Jahanian fjahanian at apple.com
Mon Jun 1 09:15:40 PDT 2009


On May 31, 2009, at 6:22 PM, Eli Friedman wrote:

> Author: efriedma
> Date: Sun May 31 20:22:52 2009
> New Revision: 72683
>
> URL: http://llvm.org/viewvc/llvm-project?rev=72683&view=rev
> Log:
> Disable type merging with gc attributes.  This has a number of nasty
> properties at the moment:
>
> 1. It allows stuff like "__strong id x; __weak id x;".
>
> 2. For constructs like "__strong id x; id x;", subsequent references  
> to
> x lose the objc_gc attribute.
>
> 3. This incorrectly allows merges involving the address_space  
> attribute.
>
> 4. Constructs like "id x; /* some code using x */ __weak id x;" don't
> apply the objc_gc attribute consistently to all uses of x.
>

It is true that (4) may break user code in an obscure fashion. But  
attributes are not part
of the type system and they can be changed at will, I think. You may  
find examples of other attributes
which are changeable. __strong/__weak has been in gcc's implementation  
for several years now and
clang follows suit.  I am more concerned about __strong id x; .....;  
id x. Because the first decl is redundant and
will have no impact. But disallowing it will break many projects.

- Fariborz

> The first three can probably be fixed relatively easily; the fourth
> would be extremely difficult to fix.
>
>
> Modified:
>    cfe/trunk/lib/AST/ASTContext.cpp
>    cfe/trunk/test/SemaObjC/objc2-merge-gc-attribue-decl.m
>
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=72683&r1=72682&r2=72683&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Sun May 31 20:22:52 2009
> @@ -3020,8 +3020,8 @@
>   if (LHSCan.getCVRQualifiers() != RHSCan.getCVRQualifiers())
>     return QualType();
>
> -  Type::TypeClass LHSClass = LHSCan.getUnqualifiedType()- 
> >getTypeClass();
> -  Type::TypeClass RHSClass = RHSCan.getUnqualifiedType()- 
> >getTypeClass();
> +  Type::TypeClass LHSClass = LHSCan->getTypeClass();
> +  Type::TypeClass RHSClass = RHSCan->getTypeClass();
>
>   // We want to consider the two function types to be the same for  
> these
>   // comparisons, just force one to the other.
>
> Modified: cfe/trunk/test/SemaObjC/objc2-merge-gc-attribue-decl.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc2-merge-gc-attribue-decl.m?rev=72683&r1=72682&r2=72683&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/test/SemaObjC/objc2-merge-gc-attribue-decl.m (original)
> +++ cfe/trunk/test/SemaObjC/objc2-merge-gc-attribue-decl.m Sun May  
> 31 20:22:52 2009
> @@ -1,5 +1,7 @@
> // RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only - 
> verify %s
> -
> +// This is really dangerous!  Disabling for now until we work out  
> what's
> +// supposed to happen here.
> +// XFAIL
> @interface INTF @end
>
> extern INTF* p2;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list