Index: clang-tidy/misc/StaticAssertCheck.cpp =================================================================== --- clang-tidy/misc/StaticAssertCheck.cpp +++ clang-tidy/misc/StaticAssertCheck.cpp @@ -75,9 +75,18 @@ return; // False literal is not the result of macro expansion. - if (IsAlwaysFalse && - !SM.getImmediateSpellingLoc(IsAlwaysFalse->getExprLoc()).isMacroID()) - return; + if (IsAlwaysFalse) { + SourceLocation FalseLiteralLoc = + SM.getImmediateSpellingLoc(IsAlwaysFalse->getExprLoc()); + if (!FalseLiteralLoc.isMacroID()) + return; + + StringRef FalseMacroName = + Lexer::getImmediateMacroName(FalseLiteralLoc, SM, Opts); + if (FalseMacroName == "false" || FalseMacroName == "False" || + FalseMacroName == "FALSE") + return; + } SourceLocation AssertLoc = SM.getImmediateMacroCallerLoc(AssertExpansionLoc); Index: test/clang-tidy/misc-static-assert.cpp =================================================================== --- test/clang-tidy/misc-static-assert.cpp +++ test/clang-tidy/misc-static-assert.cpp @@ -12,6 +12,9 @@ #define ZERO_MACRO 0 +#define False false +#define FALSE false + #define my_macro() assert(0 == 1) // CHECK-FIXES: #define my_macro() assert(0 == 1) @@ -60,6 +63,11 @@ assert(false); // CHECK-FIXES: {{^ }}assert(false); + assert(False); + // CHECK-FIXES: {{^ }}assert(False); + assert(FALSE); + // CHECK-FIXES: {{^ }}assert(FALSE); + assert(ZERO_MACRO); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be // CHECK-FIXES: {{^ }}static_assert(ZERO_MACRO, "");