[PATCH] D97313: [clang-tidy] Tweak misc-static-assert fix in c++17

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 11:39:50 PST 2021


njames93 added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc-static-assert.cpp:40-41
   assert(myfunc(1, 2));
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be replaced by static_assert() [misc-static-assert]
-  // CHECK-FIXES: {{^  }}static_assert(myfunc(1, 2), "");
+  // CHECK-MESSAGES-CXX11: :[[@LINE-1]]:3: warning: found assert() that could be replaced by static_assert() [misc-static-assert]
+  // CHECK-MESSAGES-CXX17: :[[@LINE-2]]:3: warning: found assert() that could be replaced by static_assert() [misc-static-assert]
+  // CHECK-FIXES-CXX11: {{^  }}static_assert(myfunc(1, 2), "");
----------------
This seems to be a shortfall in check_clang_tidy.py. It will pass CHECK-MESSAGES-CXX(11|17) as a prefix to file check even though it knows it wasn't in the source file. This causes filecheck to fail.
Duplicating the CHECK-MESSAGE for each is just a work around.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97313



More information about the cfe-commits mailing list