aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-02-10 00:32:12 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-02-10 00:32:12 +0000
commit6de8b62ae42818c0bd8878b0d1900e17c7c43e0e (patch)
tree4f75f93d7912ae189968909c802878d6cf0b5a1e
parent885237354fd902998c6ae9d7cc3dc8de96b123dc (diff)
Reverse a partial fix patch for radar 7214820. It broke some code and
I don't have time to refix it for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95733 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp19
-rw-r--r--test/SemaObjC/gc-attr-block-ivar.m17
-rw-r--r--test/SemaObjC/objc2-merge-gc-attribue-decl.m4
3 files changed, 5 insertions, 35 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index c9d85c84f9..7912a93421 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -4311,24 +4311,11 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) {
bool allRTypes = true;
// Check return type
- QualType LRES = lbase->getResultType();
- QualType RRES = rbase->getResultType();
- Qualifiers::GC GC_L = LRES.getObjCGCAttr();
- Qualifiers::GC GC_R = RRES.getObjCGCAttr();
- // __weak/__strong attribute on one function/block return type but
- // not the other is OK.
- if (GC_L != GC_R) {
- if (GC_R == Qualifiers::GCNone)
- RRES = getObjCGCQualType(RRES, GC_L);
- else if (GC_L == Qualifiers::GCNone)
- LRES = getObjCGCQualType(LRES, GC_R);
- }
-
- QualType retType = mergeTypes(LRES, RRES);
+ QualType retType = mergeTypes(lbase->getResultType(), rbase->getResultType());
if (retType.isNull()) return QualType();
- if (getCanonicalType(retType) != getCanonicalType(LRES))
+ if (getCanonicalType(retType) != getCanonicalType(lbase->getResultType()))
allLTypes = false;
- if (getCanonicalType(retType) != getCanonicalType(RRES))
+ if (getCanonicalType(retType) != getCanonicalType(rbase->getResultType()))
allRTypes = false;
// FIXME: double check this
bool NoReturn = lbase->getNoReturnAttr() || rbase->getNoReturnAttr();
diff --git a/test/SemaObjC/gc-attr-block-ivar.m b/test/SemaObjC/gc-attr-block-ivar.m
deleted file mode 100644
index c3e00337fd..0000000000
--- a/test/SemaObjC/gc-attr-block-ivar.m
+++ /dev/null
@@ -1,17 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc %s
-
-@interface Intf {
-@public
- void (^block) (id);
- __weak void (^weak_block) (id);
- void (*fptr) (id);
- __weak void (*weak_fptr) (id);
-}
-@end
-
-int main() {
- Intf *observer;
- return (observer->block != observer->weak_block ||
- observer->fptr != observer->weak_fptr);
-}
-
diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
index f8d5f0018d..673a7417e3 100644
--- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m
+++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
@@ -10,8 +10,8 @@ extern id p1;
extern id CFRunLoopGetMain();
extern __strong id CFRunLoopGetMain();
-extern __weak id WLoopGetMain();
-extern id WLoopGetMain();
+extern __weak id WLoopGetMain(); // expected-note {{previous declaration is here}}
+extern id WLoopGetMain(); // expected-error {{conflicting types for 'WLoopGetMain'}}
extern id p3; // expected-note {{previous definition is here}}
extern __weak id p3; // expected-error {{redefinition of 'p3' with a different type}}