[cfe-commits] r58007 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjC/compare-qualified-id.m

Steve Naroff snaroff at apple.com
Wed Oct 22 15:40:30 PDT 2008


Author: snaroff
Date: Wed Oct 22 17:40:28 2008
New Revision: 58007

URL: http://llvm.org/viewvc/llvm-project?rev=58007&view=rev
Log:
Fix <rdar://problem/6311947> clang on xcode (regression): error: use of undeclared identifier 'expandedValue'.

Mea culpa: I introduced this regresson in the following 2 commits: r57529 (10/14), r57841 (10/20).

Added:
    cfe/trunk/test/SemaObjC/compare-qualified-id.m
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=58007&r1=58006&r2=58007&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Oct 22 17:40:28 2008
@@ -2153,7 +2153,7 @@
       Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers,
            lType.getAsString(), rType.getAsString(),
            lex->getSourceRange(), rex->getSourceRange());
-      return QualType();
+      return Context.IntTy;
     }
     if (ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) {
       ImpCastExprToType(rex, lType);
@@ -2163,7 +2163,7 @@
         Diag(loc, diag::warn_incompatible_qualified_id_operands, 
              lex->getType().getAsString(), rex->getType().getAsString(),
              lex->getSourceRange(), rex->getSourceRange());
-        return QualType();
+        return Context.IntTy;
       }
     }
   }

Added: cfe/trunk/test/SemaObjC/compare-qualified-id.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/compare-qualified-id.m?rev=58007&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/compare-qualified-id.m (added)
+++ cfe/trunk/test/SemaObjC/compare-qualified-id.m Wed Oct 22 17:40:28 2008
@@ -0,0 +1,33 @@
+// RUN: clang -fsyntax-only -verify %s
+
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at protocol NSObject  - (BOOL)isEqual:(id)object; @end
+ at protocol NSCopying  - (id)copyWithZone:(NSZone *)zone; @end
+ at protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone; @end
+ at protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
+ at interface NSObject <NSObject> {} @end
+typedef struct {} NSFastEnumerationState;
+ at protocol NSFastEnumeration  - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; @end
+ at interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>  - (NSUInteger)count; @end
+ at interface NSMutableDictionary : NSDictionary  - (void)removeObjectForKey:(id)aKey; @end
+extern NSString * const NSTaskDidTerminateNotification;
+
+ at interface XCPropertyExpansionContext : NSObject <NSCopying> {
+  NSMutableDictionary * _propNamesToPropValuesCache;
+} @end
+
+ at protocol XCPropertyValues <NSObject, NSCopying>
+- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
+ at end
+
+ at implementation XCPropertyExpansionContext
+- (NSString *)expandedValueForProperty:(NSString *)property {
+  id <XCPropertyValues> cachedValueNode = [_propNamesToPropValuesCache objectForKey:property]; // expected-warning {{method '-objectForKey:' not found (return type defaults to 'id')}}
+  if (cachedValueNode == ((void *)0)) { } // expected-warning {{comparison of distinct pointer types ('id<XCPropertyValues>' and 'void *')}}
+  NSString * expandedValue = [cachedValueNode evaluateAsStringInContext:self withNestingState:((void *)0)];
+  return expandedValue;
+}
+





More information about the cfe-commits mailing list