[PATCH] D35257: [clang-tidy] Add new modernize use unary assert check

Barancsuk Lilla via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 07:02:44 PDT 2017


barancsuk created this revision.
barancsuk added a project: clang-tools-extra.
Herald added subscribers: xazax.hun, JDevlieghere, mgorny.

The check finds `static_assert` declarations with empty messages, and
 replaces them with an unary `static_assert` declaration.

The check is only applicable for C++17 code.

The following code:

  void f_textless(int a){
    static_assert(sizeof(a) <= 10, "");
  }
   

is replaced by:

  void f_textless(int a){
    static_assert(sizeof(a) <= 10 );
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D35257

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UnaryStaticAssertCheck.cpp
  clang-tidy/modernize/UnaryStaticAssertCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-unary-static-assert.rst
  test/clang-tidy/modernize-unary-static-assert.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35257.106020.patch
Type: text/x-patch
Size: 6409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170711/c07027a9/attachment-0001.bin>


More information about the cfe-commits mailing list