[PATCH] D14560: [Clang] Fix Clang-tidy modernize-use-auto in some files in lib/AST; other minor cleanups.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 06:36:54 PST 2015
aaron.ballman added inline comments.
================
Comment at: lib/AST/ASTContext.cpp:7930
@@ -7931,3 +7929,3 @@
-ASTMutationListener::~ASTMutationListener() { }
+ASTMutationListener::~ASTMutationListener() = default;
----------------
Eugene.Zelenko wrote:
> aaron.ballman wrote:
> > This is... interesting. Explicitly defaulting an out-of-line function definition is not something I've ever encountered before. What benefit does this provide?
> It's explicitly tells that destructor has default implementation.
I'm not certain this is an improvement. Using =default in the declaration is an improvement because it tells the compiler up front "this has the default implementation" and the compiler can benefit from that information in other ways. When it's on an out-of-line definition, it does say "this has the default implementation", but it doesn't give the compiler any benefit over {}, so the only benefit is up to the reader of the code. I think someone can read {} to easily tell it is the default behavior, it is considerably shorter, and it doesn't cause anyone's eyes to trip over it wondering about the construct.
Repository:
rL LLVM
http://reviews.llvm.org/D14560
More information about the cfe-commits
mailing list