[libcxx-commits] [libcxx] 81fb5a0 - [libc++] Fixes clang-tidy plugin for clang-tidy 17.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 24 09:07:20 PDT 2023


Author: Mark de Wever
Date: 2023-05-24T18:07:12+02:00
New Revision: 81fb5a0e1cf8550ad20700ea1461030de0bc052d

URL: https://github.com/llvm/llvm-project/commit/81fb5a0e1cf8550ad20700ea1461030de0bc052d
DIFF: https://github.com/llvm/llvm-project/commit/81fb5a0e1cf8550ad20700ea1461030de0bc052d.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp b/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
index c4a51fad72720..5252087d55ee9 100644
--- a/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
@@ -69,7 +69,7 @@ std::vector<const char*> get_standard_attributes(const clang::LangOptions& lang_
 }
 
 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 @@ AST_MATCHER(clang::Attr, isPretty) {
   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;
 }


        


More information about the libcxx-commits mailing list