[cfe-commits] r51901 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/gcc-cast-ext.m

Steve Naroff snaroff at apple.com
Tue Jun 3 06:21:30 PDT 2008


Author: snaroff
Date: Tue Jun  3 08:21:30 2008
New Revision: 51901

URL: http://llvm.org/viewvc/llvm-project?rev=51901&view=rev
Log:
Finish up r51900.

Added:
    cfe/trunk/test/Sema/gcc-cast-ext.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=51901&r1=51900&r2=51901&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jun  3 08:21:30 2008
@@ -848,10 +848,11 @@
     if (!castType->isScalarType() && !castType->isVectorType()) {
       // GCC struct/union extension.
       if (castType == castExpr->getType() &&
-          castType->isStructureType() || castType->isUnionType())
-        return Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar,
-                    SourceRange(LParenLoc, RParenLoc));
-      else
+          castType->isStructureType() || castType->isUnionType()) {
+        Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar,
+             SourceRange(LParenLoc, RParenLoc));
+        return new CastExpr(castType, castExpr, LParenLoc);
+      } else
         return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar, 
                     castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
     }

Added: cfe/trunk/test/Sema/gcc-cast-ext.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/gcc-cast-ext.m?rev=51901&view=auto

==============================================================================
--- cfe/trunk/test/Sema/gcc-cast-ext.m (added)
+++ cfe/trunk/test/Sema/gcc-cast-ext.m Tue Jun  3 08:21:30 2008
@@ -0,0 +1,18 @@
+// RUN: clang %s -verify -fms-extensions
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+typedef struct _NSRange { } NSRange;
+
+ at class PBXFileReference;
+
+ at interface PBXDocBookmark
++ alloc;
+- autorelease;
+ at end
+ at implementation PBXDocBookmark  // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'autorelease' not found}} expected-warning {{method definition for 'alloc' not found}}
+
++ (id)bookmarkWithFileReference:(PBXFileReference *)fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor
+{
+    NSRange r = (NSRange)range;
+    return [[[self alloc] initWithFileReference:fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor] autorelease];  // expected-warning {{method '-initWithFileReference:gylphRange:anchor:' not found (return type defaults to 'id')}}
+}
+ at end





More information about the cfe-commits mailing list