[PATCH] D44968: [ObjC] Generalize NRVO to cover non-trivial C structs
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 27 21:05:13 PDT 2018
rjmccall added a comment.
Is it possible to just do this for all structs? I don't think it hurts anything to do it for structs that are trivial and returned indirectly, and it would certainly be nice to construct C return values in-place even if they're guilty of nothing more than being, y'know, really really big.
================
Comment at: lib/CodeGen/CGDecl.cpp:1116
if (const RecordType *RecordTy = Ty->getAs<RecordType>()) {
- if (!cast<CXXRecordDecl>(RecordTy->getDecl())->hasTrivialDestructor()) {
+ const auto *RD = cast<RecordDecl>(RecordTy->getDecl());
+ const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
----------------
I think this cast isn't necessary.
Repository:
rC Clang
https://reviews.llvm.org/D44968
More information about the cfe-commits
mailing list