[PATCH] D78767: [Sema] Teach -Wcast-align to compute a more accurate alignment when the source expression has array subscript or pointer arithmetic operators

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 24 12:59:20 PDT 2020


ahatanak marked an inline comment as done.
ahatanak added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:14844
+  if (auto *VD = Result.Base.dyn_cast<const ValueDecl *>())
+    return Ctx.getDeclAlign(VD).alignmentAtOffset(Result.Offset);
+
----------------
rjmccall wrote:
> Does this do the right thing if `getDeclAlign` returns 0, or can that never happen?
I looked at `getDeclAlign` and, as far as I can tell, it returns an alignment that is larger than 0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78767





More information about the cfe-commits mailing list