[cfe-commits] r74411 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Nate Begeman natebegeman at mac.com
Sun Jun 28 12:12:59 PDT 2009


Author: sampo
Date: Sun Jun 28 14:12:57 2009
New Revision: 74411

URL: http://llvm.org/viewvc/llvm-project?rev=74411&view=rev
Log:
Fix incorrect AST's being produced, noticed by Eli.
The issue this was working around is no longer present in TOT clang.

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=74411&r1=74410&r2=74411&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Jun 28 14:12:57 2009
@@ -3623,15 +3623,12 @@
     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 @@
     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();





More information about the cfe-commits mailing list