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

Fixes build failure introduce by 47ccfd7.
This commit is contained in:
Corentin Jabot
2023-07-20 09:17:56 +02:00
parent 9324e1be07
commit 528447ff26

View File

@@ -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();