From: Eli Friedman Date: Mon, 1 Jun 2009 01:22:52 +0000 (+0000) Subject: Disable type merging with gc attributes. This has a number of nasty X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=852d63b806c5cbd730c6b9d696e2e27d02546b49;p=clang 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. The first three can probably be fixed relatively easily; the fourth would be extremely difficult to fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72683 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c719b0bc7d..a4b9acc110 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -3020,8 +3020,8 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { 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. diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m index cdcd058739..452d0cf334 100644 --- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m +++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m @@ -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;