[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 11:34:04 PDT 2016


aaron.ballman added inline comments.


================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:404
+                [](const Expr *Expr) { return Expr->getType(); },
+                "use auto when initializing with new to avoid "
+                "duplicating the type name");
----------------
malcolm.parsons wrote:
> aaron.ballman wrote:
> > Quote use of `auto` and `new` in the diagnostic since they're syntax rather than english.
> A lot of clang-tidy diagnostics don't quote syntax/functions/types:
> 
> ```
> "do not use reinterpret_cast"
> "pass by value and use std::move"
> "use nullptr"
> "the shrink_to_fit method should be used "
> "use std::move to transfer ownership"
> "auto_ptr is deprecated, use unique_ptr instead"
> "use auto when declaring iterators"
> "use range-based for loop instead"
> "use emplace_back instead of push_back"
> "prefer a lambda to std::bind"
> ...
> ```
clang-tidy hasn't always done a good job of following the conventions that clang uses for its diagnostics, but the reason I pointed this wording out specifically is because things like "new" are a valid word to use in an English sentence too, which makes the diagnostic text harder to understand without the quotes.


Repository:
  rL LLVM

https://reviews.llvm.org/D25316





More information about the cfe-commits mailing list