[libcxx-commits] [PATCH] D151224: [libc++] Fixes clang-tidy plugin for clang-tidy 17.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 23 11:20:41 PDT 2023


Mordante created this revision.
Herald added subscribers: carlosgalvezp, jdoerfert.
Herald added a project: All.
Mordante published this revision for review.
Mordante added a reviewer: philnik.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

When using with clang-tidy 17 Node.getAttrName() sometimes returns a
nullptr. This caused segfaults in the CI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151224

Files:
  libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp


Index: libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
===================================================================
--- libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
+++ libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
@@ -69,7 +69,7 @@
 }
 
 AST_MATCHER(clang::Attr, isPretty) {
-  if (Node.isKeywordAttribute())
+  if (Node.isKeywordAttribute() || !Node.getAttrName())
     return false;
   if (Node.isCXX11Attribute() && !Node.hasScope()) {
     if (isUgly(Node.getAttrName()->getName()))
@@ -80,8 +80,7 @@
   if (Node.hasScope())
     if (!isUgly(Node.getScopeName()->getName()))
       return true;
-  if (Node.getAttrName())
-    return !isUgly(Node.getAttrName()->getName());
+  return !isUgly(Node.getAttrName()->getName());
 
   return false;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151224.524739.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230523/b42485e5/attachment.bin>


More information about the libcxx-commits mailing list