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

John McCall rjmccall at apple.com
Tue Jun 29 11:50:41 PDT 2010

On Jun 29, 2010, at 11:41 AM, John Thompson wrote:
> The enclosed patch seems to work, checking for a parm count of 1 and a vector inside.
> Can I check it in? 

+    if (PE->getNumExprs() == 1) {
+      Type *peType = PE->getExpr(0)->getType().getTypePtr();
+      if (!peType || !peType->isVectorType())
+        isAltiVecLiteral = true;

Please remove the null check;  if the subexpression's type is null, that's a
problem we should know about rather than just passively succeeding.

Also, QualType has an overloaded operator->, so it should be sufficient to replace
these last three lines with:
  if (!PE->getExpr(0)->getType()->isVectorType())
    isAltiVecLiteral = true;

Feel free to check in after making this change if it passes the test suite.


More information about the cfe-commits mailing list