I checked this patch on my own build on RHEL 6. Regressions were OK.
Details
Diff Detail
Event Timeline
Some of these are great improvements, especially using auto for iterators etc.
But I'm not sure we'll want to start changing "Foo *foo = new Foo;" to use auto everywhere. I expect we'd have to do that in a huge number of places?
include/clang/AST/ASTVector.h | ||
---|---|---|
385 | I'm not sure this one is an improvement. | |
include/clang/AST/DeclContextInternals.h | ||
90 | Same here. | |
include/clang/AST/DeclTemplate.h | ||
1726 | But here it does make it nicer :-) |
include/clang/Analysis/Analyses/Consumed.h | ||
---|---|---|
266 | I don't know whether this is an improvement or not. | |
include/clang/Rewrite/Core/Rewriter.h | ||
171 | Not that this matters in the cases in this code, but const iterator is not the same as const_iterator. I think these changes are a step forward in terms of readability, but a step backwards in terms of the type system. | |
tools/libclang/Indexing.cpp | ||
672 | The extra parens do not add any value here. | |
utils/TableGen/ClangAttrEmitter.cpp | ||
959 | I really like all of these changes to this file! |
include/clang/AST/ASTVector.h | ||
---|---|---|
385 | At least handling of new will be consistent. This will also silent Clang-tidy warning. | |
include/clang/Analysis/Analyses/Consumed.h | ||
266 | This was changed for consistency with other code. I also think that it's good idea to place one statement per line. | |
include/clang/Rewrite/Core/Rewriter.h | ||
171 | I'm still learning C++11, so advices how to handle such situations properly are welcome! | |
tools/libclang/Indexing.cpp | ||
672 | Will remove them. |
include/clang/AST/ASTVector.h | ||
---|---|---|
385 | I'm not too concerned about the clang-tidy warning. It suggests that perhaps this checker could use an option to control this behavior, however. I agree with Hans that a lot of the treatments of new expressions don't really seem to be improvements. | |
include/clang/AST/DeclTemplate.h | ||
1726 | I wonder if the heuristic is: when the new expression spans multiple lines, only replace the declaration type with auto if it causes the new expression to become a single-line expression. | |
include/clang/Analysis/Analyses/Consumed.h | ||
266 | This pattern is used in many places in the code base, it reduces vertical clutter, and it could be argued that it is easier to read because you don't have to interpret the namespace hierarchy. | |
include/clang/Rewrite/Core/Rewriter.h | ||
171 | In this case, I suppose it doesn't matter at all -- RewriteBuffers is a member variable being accessed from a const method, and so it will return a const_iterator. So technically, you don't even need the const here, just auto I. The issue is more with code like: struct S { SomeContainer C; void f() { SomeContainer::const_iterator I = C.begin(); } }; Replacing with auto here will deduce SomeContainer::iterator. The only way around that is with ugly casting, at which point I think leaving the declaration alone is the better choice. For this code, I would remove the const and just leave it as auto I. |
I'm not sure this one is an improvement.