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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to