[PATCH] D35257: [clang-tidy] Add new modernize use unary assert check
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 11 08:20:07 PDT 2017
aaron.ballman added inline comments.
================
Comment at: clang-tidy/modernize/UnaryStaticAssertCheck.cpp:32
+
+ if (!AssertMessage || AssertMessage->getLength())
+ return;
----------------
I think this should be `!AssertMessage->getLength()`
================
Comment at: test/clang-tidy/modernize-unary-static-assert.cpp:18
+void f_with_tex(int a) {
+ static_assert(sizeof(a) <= 10, "Sie of variable a is out of range!");
+}
----------------
typo: Sie
================
Comment at: test/clang-tidy/modernize-unary-static-assert.cpp:23
+
+void f_incorrect_assert() { static_assert(""); }
----------------
I think you also need to handle the case where the string literal is empty but produces from a macro expansion. e.g.,
```
#define MSG ""
static_assert(condition, MSG);
```
This should not suggest removing the empty string literal.
https://reviews.llvm.org/D35257
More information about the cfe-commits
mailing list