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



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

Reply via email to