]> granicus.if.org Git - clang/commitdiff
Fix decl type merges when they have
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 15 Apr 2009 21:54:48 +0000 (21:54 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 15 Apr 2009 21:54:48 +0000 (21:54 +0000)
__string/__weak attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69229 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/SemaObjC/objc2-merge-gc-attribue-decl.m [new file with mode: 0644]

index f0c2d2be4847907a3944ebb36b0e31c4f77739c1..63d88b2ec732d4aa245000702a77f7c0f1b4be49 100644 (file)
@@ -2937,8 +2937,8 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
   if (LHSCan.getCVRQualifiers() != RHSCan.getCVRQualifiers())
     return QualType();
 
-  Type::TypeClass LHSClass = LHSCan->getTypeClass();
-  Type::TypeClass RHSClass = RHSCan->getTypeClass();
+  Type::TypeClass LHSClass = LHSCan.getUnqualifiedType()->getTypeClass();
+  Type::TypeClass RHSClass = RHSCan.getUnqualifiedType()->getTypeClass();
 
   // We want to consider the two function types to be the same for these
   // comparisons, just force one to the other.
@@ -2963,7 +2963,7 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
   if (LHSClass != RHSClass) {
     const ObjCInterfaceType* LHSIface = LHS->getAsObjCInterfaceType();
     const ObjCInterfaceType* RHSIface = RHS->getAsObjCInterfaceType();
-
+    
     // 'id' and 'Class' act sort of like void* for ObjC interfaces
     if (LHSIface && (isObjCIdStructType(RHS) || isObjCClassStructType(RHS)))
       return LHS;
diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
new file mode 100644 (file)
index 0000000..cdcd058
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+
+@interface INTF @end
+
+extern INTF* p2;
+extern __strong INTF* p2;
+
+extern __strong id p1;
+extern id p1;
+
+extern id CFRunLoopGetMain();
+extern __strong id CFRunLoopGetMain();
+
+extern __strong INTF* p3;
+extern id p3;
+