]> granicus.if.org Git - clang/commitdiff
Fix incorrect AST's being produced, noticed by Eli.
authorNate Begeman <natebegeman@mac.com>
Sun, 28 Jun 2009 19:12:57 +0000 (19:12 +0000)
committerNate Begeman <natebegeman@mac.com>
Sun, 28 Jun 2009 19:12:57 +0000 (19:12 +0000)
The issue this was working around is no longer present in TOT clang.

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

lib/Sema/SemaExpr.cpp

index 6e111651066645e46094e5118a4d88791fe8b5da..fe284f73b0d58c8aa5709edb29695ff974f518f4 100644 (file)
@@ -3623,15 +3623,12 @@ inline QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex,
     std::swap(rhsType, lhsType);
   }
   
-  // Handle the case of an ext vector and scalar
+  // Handle the case of an ext vector and scalar.
   if (const ExtVectorType *LV = lhsType->getAsExtVectorType()) {
     QualType EltTy = LV->getElementType();
     if (EltTy->isIntegralType() && rhsType->isIntegralType()) {
       if (Context.getIntegerTypeOrder(EltTy, rhsType) >= 0) {
-        ImpCastExprToType(rex, EltTy);
-        rex = new (Context) CStyleCastExpr(lhsType, rex, lhsType,
-                                           rex->getSourceRange().getBegin(),
-                                           rex->getSourceRange().getEnd());
+        ImpCastExprToType(rex, lhsType);
         if (swapped) std::swap(rex, lex);
         return lhsType;
       }
@@ -3639,17 +3636,14 @@ inline QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex,
     if (EltTy->isRealFloatingType() && rhsType->isScalarType() &&
         rhsType->isRealFloatingType()) {
       if (Context.getFloatingTypeOrder(EltTy, rhsType) >= 0) {
-        ImpCastExprToType(rex, EltTy);
-        rex = new (Context) CStyleCastExpr(lhsType, rex, lhsType,
-                                           rex->getSourceRange().getBegin(),
-                                           rex->getSourceRange().getEnd());
+        ImpCastExprToType(rex, lhsType);
         if (swapped) std::swap(rex, lex);
         return lhsType;
       }
     }
   }
   
-  // You cannot convert between vector values of different size.
+  // Vectors of different size or scalar and non-ext-vector are errors.
   Diag(Loc, diag::err_typecheck_vector_not_convertable)
     << lex->getType() << rex->getType()
     << lex->getSourceRange() << rex->getSourceRange();