[PATCH] Sema: Warn on sizeof on binary ops on decayed arrays.

Sean Silva silvas at purdue.edu
Sun Mar 24 08:01:54 PDT 2013



================
Comment at: lib/Sema/SemaExpr.cpp:3115-3118
@@ +3114,6 @@
+          << BO->getLHS()->getType() << LHSICE->getSubExpr()->getType();
+      else if (!LHSDecay && RHSDecay && BO->getType() == RHSICE->getType())
+        Diag(BO->getOperatorLoc(), diag::warn_sizeof_array_decay)
+          << BO->getRHS()->getSourceRange()
+          << BO->getRHS()->getType() << RHSICE->getSubExpr()->getType();
+    }
----------------
This checks "sizeof(x op array)", right? If so, the comment above probably should at least mention it. Also, would it be feasible to factor out this whole diagnostic check into a static helper?


http://llvm-reviews.chandlerc.com/D571



More information about the cfe-commits mailing list