Skip to content

Commit 81fb5a0

Browse files
committed
[libc++] Fixes clang-tidy plugin for clang-tidy 17.
When using with clang-tidy 17 Node.getAttrName() sometimes returns a nullptr. This caused segfaults in the CI. Reviewed By: philnik, #libc Differential Revision: https://reviews.llvm.org/D151224
1 parent 94daee2 commit 81fb5a0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ std::vector<const char*> get_standard_attributes(const clang::LangOptions& lang_
6969
}
7070

7171
AST_MATCHER(clang::Attr, isPretty) {
72-
if (Node.isKeywordAttribute())
72+
if (Node.isKeywordAttribute() || !Node.getAttrName())
7373
return false;
7474
if (Node.isCXX11Attribute() && !Node.hasScope()) {
7575
if (isUgly(Node.getAttrName()->getName()))
@@ -80,8 +80,7 @@ AST_MATCHER(clang::Attr, isPretty) {
8080
if (Node.hasScope())
8181
if (!isUgly(Node.getScopeName()->getName()))
8282
return true;
83-
if (Node.getAttrName())
84-
return !isUgly(Node.getAttrName()->getName());
83+
return !isUgly(Node.getAttrName()->getName());
8584

8685
return false;
8786
}

0 commit comments

Comments
 (0)