Author: Corentin Jabot
Date: 2023-07-20T09:23:08+02:00
New Revision: 528447ff265a6c58b43af6cff2a3ee0ce5784331

URL: 
https://github.com/llvm/llvm-project/commit/528447ff265a6c58b43af6cff2a3ee0ce5784331
DIFF: 
https://github.com/llvm/llvm-project/commit/528447ff265a6c58b43af6cff2a3ee0ce5784331.diff

LOG: [clang-tools-extra] the message in a static_assert is not always a string 
literal

Fixes build failure introduce by 47ccfd7.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp
index 81b21565667e8a..c90d2e4f764b89 100644
--- a/clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp
@@ -21,7 +21,8 @@ void UnaryStaticAssertCheck::registerMatchers(MatchFinder 
*Finder) {
 void UnaryStaticAssertCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *MatchedDecl =
       Result.Nodes.getNodeAs<StaticAssertDecl>("static_assert");
-  const StringLiteral *AssertMessage = MatchedDecl->getMessage();
+  const auto *AssertMessage =
+      dyn_cast_if_present<StringLiteral>(MatchedDecl->getMessage());
 
   SourceLocation Loc = MatchedDecl->getLocation();
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to