[PATCH] D21099: [Sema] Teach -Wcast-align to look at the aligned attribute of the declared variables

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 09:29:34 PST 2016


arphaman added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:10270
 
+static void setSrcAlign(Expr *SE, CharUnits &SrcAlign, ASTContext &Context) {
+  if (const auto *DRE = dyn_cast<DeclRefExpr>(SE))
----------------
I'm not sure if you can, since I don't really know `CharUnits`, but I think you should just return it instead of passing it as a parameter if it's a POD type (if you will end up doing that you should rename this function as well).


================
Comment at: lib/Sema/SemaChecking.cpp:10270
 
+static void setSrcAlign(Expr *SE, CharUnits &SrcAlign, ASTContext &Context) {
+  if (const auto *DRE = dyn_cast<DeclRefExpr>(SE))
----------------
arphaman wrote:
> I'm not sure if you can, since I don't really know `CharUnits`, but I think you should just return it instead of passing it as a parameter if it's a POD type (if you will end up doing that you should rename this function as well).
Please add a brief doc comment as well.


https://reviews.llvm.org/D21099





More information about the cfe-commits mailing list