[cfe-commits] [REVIEW] - Altivec vector literal casting problem - need feedback - AST/Sema

John Thompson john.thompson.jtsoftware at gmail.com
Mon Jun 28 12:05:27 PDT 2010


> Is there a reason why the fix can't be "the operand is of vector type and
therefore this is a vector cast and not a vector literal"?

In the following:

Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
                               SourceLocation RParenLoc, ExprArg Op,
                               TypeSourceInfo *TInfo) {
  ParenListExpr *PE = (ParenListExpr *)Op.get();
  QualType Ty = TInfo->getType();
  bool isAltiVecLiteral = false;
  // Check for an altivec literal,
  if (getLangOptions().AltiVec && Ty->isVectorType()) {
    if (PE->getNumExprs() == 0) {
      Diag(PE->getExprLoc(), diag::err_altivec_empty_initializer);
      return ExprError();
    }
    *Type *peType = PE->getType().getTypePtr();
*    if (peType) {
      if (peType->isVectorType())
        isAltiVecLiteral = true;
    }
  }
  // If this is an altivec initializer, '(' type ')' '(' init, ..., init ')'
  // then handle it as such.
  if (isAltiVecLiteral) {
...

The peType is null, which I assume means the ParenListExpr type has not been
set.

Should it be set at this point, or is this the wrong place to be checking?

-John

-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100628/c90eff14/attachment.html>


More information about the cfe-commits mailing list