[PATCH] D62412: [clang-tidy] Fix unused-variable warning after r361647.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 01:06:31 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE361749: [clang-tidy] Fix unused-variable warning after r361647. (authored by hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62412?vs=201289&id=201481#toc

Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62412/new/

https://reviews.llvm.org/D62412

Files:
  clang-tidy/utils/TransformerClangTidyCheck.cpp


Index: clang-tidy/utils/TransformerClangTidyCheck.cpp
===================================================================
--- clang-tidy/utils/TransformerClangTidyCheck.cpp
+++ clang-tidy/utils/TransformerClangTidyCheck.cpp
@@ -7,21 +7,22 @@
 //===----------------------------------------------------------------------===//
 
 #include "TransformerClangTidyCheck.h"
+#include "llvm/ADT/STLExtras.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 using tooling::RewriteRule;
 
-TransformerClangTidyCheck::TransformerClangTidyCheck(tooling::RewriteRule R,
+TransformerClangTidyCheck::TransformerClangTidyCheck(RewriteRule R,
                                                      StringRef Name,
                                                      ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context), Rule(std::move(R)) {
-  for (const auto &Case : Rule.Cases) {
-    assert(Case.Explanation != nullptr &&
-           "clang-tidy checks must have an explanation by default;"
-           " explicitly provide an empty explanation if none is desired");
-  }
+  assert(llvm::all_of(Rule.Cases, [](const RewriteRule::Case &C) {
+                       return C.Explanation != nullptr;
+                     }) &&
+         "clang-tidy checks must have an explanation by default;"
+         " explicitly provide an empty explanation if none is desired");
 }
 
 void TransformerClangTidyCheck::registerMatchers(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62412.201481.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190527/f00af25c/attachment.bin>


More information about the cfe-commits mailing list