[PATCH] D118350: [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct is passed to a function

Zarko Todorovski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 08:31:49 PST 2022


ZarkoCA marked 8 inline comments as done.
ZarkoCA added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:5255
+  const auto *PVD = dyn_cast<ParmVarDecl>(
+      (dyn_cast<DeclRefExpr>(
+           (dyn_cast<ImplicitCastExpr>(Arg->IgnoreParens()))->getSubExpr()))
----------------
sfertile wrote:
> I find these longer lines hard to read. I way you had the original checks structured was good, my suggestion was really meant to change only the nesting. I think keeping the same format you would have ended up with something that looks like
> 
> ```
> const auto *ICE = dyn_cast<ImplicitCastExpr>(Arg->IgnoreParens());
> if (!ICE)
>   return;
> 
> const auto *DR = dyn_cast<DeclRefExpr>(ICE->getSubExpr());
> if (!DR)
>   return;
> 
> auto *PD = dyn_cast<ParmVarDecl>(DR->getDecl();
> if (!PD || !PD->getType()->isRecordType())
>   return;
> ```
> 
I agree I find it easier to read this way as well. Thanks for clearing that up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118350/new/

https://reviews.llvm.org/D118350



More information about the cfe-commits mailing list