[clang-tools-extra] 528447f - [clang-tools-extra] the message in a static_assert is not always a string literal
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 20 00:23:16 PDT 2023
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();
More information about the cfe-commits
mailing list