[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 12:54:25 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1885
+              Context.getBaseElementType(CTy->getElementType())
+                  ->getAs<BuiltinType>())
+        if (BTy->getKind() == BuiltinType::Double ||
----------------
Xiangling_L wrote:
> hubert.reinterpretcast wrote:
> > I believe `castAs` should be expected to succeed here.
> `castAs` is not declared in current context, do we really want to use it by introducing one more header?
`castAs` should be declared:
https://clang.llvm.org/doxygen/classclang_1_1Type.html#a436b8b08ae7f2404b4712d37986194ce

Also, the additional point is that the `if` here should be unnecessary. `BTy` should not be null. We should use `castAs` to gain the guarantee (with assertions) that `BTy` is not null.


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

https://reviews.llvm.org/D79719





More information about the cfe-commits mailing list