[cfe-commits] r46328 - in /cfe/trunk: AST/Type.cpp Sema/SemaExpr.cpp

Steve Naroff snaroff at apple.com
Thu Jan 24 14:55:06 PST 2008


Author: snaroff
Date: Thu Jan 24 16:55:05 2008
New Revision: 46328

URL: http://llvm.org/viewvc/llvm-project?rev=46328&view=rev
Log:

Exclude vectors from Type::isScalar() predicate.


Modified:
    cfe/trunk/AST/Type.cpp
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=46328&r1=46327&r2=46328&view=diff

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Thu Jan 24 16:55:05 2008
@@ -476,7 +476,6 @@
     return false;
   }
   return isa<PointerType>(CanonicalType) || isa<ComplexType>(CanonicalType) ||
-         isa<VectorType>(CanonicalType) || 
          isa<ObjCQualifiedIdType>(CanonicalType);
 }
 

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

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Jan 24 16:55:05 2008
@@ -729,10 +729,11 @@
   // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
   // type needs to be scalar.
   if (!castType->isVoidType()) {  // Cast to void allows any expr type.
-    if (!castType->isScalarType())
+    if (!castType->isScalarType() && !castType->isVectorType())
       return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar, 
                   castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
-    if (!castExpr->getType()->isScalarType())
+    if (!castExpr->getType()->isScalarType() && 
+        !castExpr->getType()->isVectorType())
       return Diag(castExpr->getLocStart(), 
                   diag::err_typecheck_expect_scalar_operand, 
                   castExpr->getType().getAsString(),castExpr->getSourceRange());





More information about the cfe-commits mailing list