Index: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp @@ -33,9 +33,11 @@ if (!(getLangOpts().CPlusPlus11 || getLangOpts().C11)) return; + auto NegatedString = unaryOperator( + hasOperatorName("!"), hasUnaryOperand(ignoringImpCasts(stringLiteral()))); auto IsAlwaysFalse = expr(anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)), - cxxNullPtrLiteralExpr(), gnuNullExpr())) + cxxNullPtrLiteralExpr(), gnuNullExpr(), NegatedString)) .bind("isAlwaysFalse"); auto IsAlwaysFalseWithCast = ignoringParenImpCasts(anyOf( IsAlwaysFalse, cStyleCastExpr(has(ignoringParenImpCasts(IsAlwaysFalse))) Index: clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp +++ clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp @@ -76,6 +76,9 @@ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be // CHECK-FIXES: {{^ }}static_assert(ZERO_MACRO, ""); + assert(!"Don't report me!"); + // CHECK-FIXES: {{^ }}assert(!"Don't report me!"); + assert(0 && "Don't report me!"); // CHECK-FIXES: {{^ }}assert(0 && "Don't report me!");