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

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 11:45:28 PDT 2016


alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:331
+void UseAutoCheck::replaceExpr(const DeclStmt *D, ASTContext *Context,
+                               TypeFn GetType, StringRef Message) {
   const auto *FirstDecl = dyn_cast<VarDecl>(*D->decl_begin());
----------------
It seems that `replaceExpr` can be implemented in a non-generic way: `GetType` could be a `std::function<QualType(Expr*)>` and the use of `ExprType` in `cast<ExprType>`could be replaced with a check whether `V->getInit()->IgnoreParenImpCasts()->getStmtClass()` is a specific `StmtClass`. WDYT?


https://reviews.llvm.org/D25316





More information about the cfe-commits mailing list