[PATCH] D49293: [ASTImporter] Add support for import of CXXInheritedCtorInitExpr.

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 16 15:55:44 PDT 2018


a_sidorin added inline comments.


================
Comment at: lib/AST/ASTImporter.cpp:6741
+
+  auto *Ctor = dyn_cast<CXXConstructorDecl>(Importer.Import(
+      E->getConstructor()));
----------------
balazske wrote:
> a_sidorin wrote:
> > cast_or_null?
> dyn_cast_or_null: Import may return nullptr, but if not, the cast should succeed (not a CXXConstructorDecl would be error).
> Or (but some lines more code) check separately for null return from Import, and then use `cast`?
Usually, we explicitly check that the imported decl has the same kind as the source one by filtering lookup results or by creating a decl of same kind. So, it's better to assert with cast_or_null in case of kind mismatch.


Repository:
  rC Clang

https://reviews.llvm.org/D49293





More information about the cfe-commits mailing list