[PATCH] D56651: [ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 16 09:58:40 PST 2019
shafik added a comment.
Thank you, this looks good but perhaps some refactoring would help improve the change.
================
Comment at: lib/AST/ASTImporter.cpp:3243
+
+ if (R) {
+ CXXDestructorDecl *ToDtor = cast<CXXDestructorDecl>(*R);
----------------
a_sidorin wrote:
> It's better to move this code to VisitFunctionDecl to keep all related stuff together.
I am not sure I agree. Having everything in `VisitFunctionDecl` makes this code harder to maintain.
================
Comment at: lib/AST/ASTImporter.cpp:3246
+
+ auto Imp = importSeq(const_cast<FunctionDecl *>(D->getOperatorDelete()),
+ D->getOperatorDeleteThisArg());
----------------
a_sidorin wrote:
> Moving this code to VisitFunctionDecl will also allow us not to create a dtor if this import fails.
At what point in `VisitFunctionDecl` would you expect this change to bail out of? A possible refactor would be to move this code to a separate function and then call that function at that point in `VisitFunctionDecl`. This would prevent `VisitFunctionDecl` from becoming even larger and I think address your concern.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56651/new/
https://reviews.llvm.org/D56651
More information about the cfe-commits
mailing list