[PATCH] D114034: [clang-tidy] fix debug-only test failure
Matt Beardsley via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 16 14:06:14 PST 2021
mattbeardsley created this revision.
mattbeardsley added a reviewer: kbobyrev.
Herald added a subscriber: xazax.hun.
mattbeardsley requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang-tools-extra.
The clang-tidy/infrastructure/pr37091.cpp test inherits the top-level .clang-tidy configuration because it doesn't specify its own checks, which ends up including misc-RenameFcn. This results in an assert when built with "-DCMAKE_BUILD_TYPE=Debug" because fQualifiedName is an empty string in "hasName(fQualifiedName)" in RenamefcnCheck.cpp (because none of the config options for misc-RenameFcn are provided - not that they should be). The HasNameMatcher::HasNameMatcher implementation behind hasName(...) asserts on empty strings.
Fixed in 2 ways:
- make the clang-tidy/infrastructure/pr37091.cpp test independent of the top-level .clang-tidy (picked an arbitrary check that I saw another clang-tidy/infrastructure test was also using: clang-tidy/infrastructure/temporaries.cpp)
- It's not useful for the top-level .clang-tidy to have misc-RenameFcn enabled anyway, so disabled that
(each of those changes fixes the debug-only assert in clang-tidy/infrastructure/pr37091.cpp on its own, but I thought each change had its own merits)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114034
Files:
.clang-tidy
clang-tools-extra/test/clang-tidy/infrastructure/pr37091.cpp
Index: clang-tools-extra/test/clang-tidy/infrastructure/pr37091.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/infrastructure/pr37091.cpp
+++ clang-tools-extra/test/clang-tidy/infrastructure/pr37091.cpp
@@ -6,5 +6,5 @@
//
// Verify that no temporary files are left behind by the clang-tidy invocation.
-// RUN: env TMPDIR=%t TEMP=%t TMP=%t clang-tidy %s -- --target=mips64
+// RUN: env TMPDIR=%t TEMP=%t TMP=%t clang-tidy -checks='-*,clang-analyzer-core.NullDereference' %s -- --target=mips64
// RUN: rmdir %t
Index: .clang-tidy
===================================================================
--- .clang-tidy
+++ .clang-tidy
@@ -1,4 +1,4 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,readability-identifier-naming'
+Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-RenameFcn,readability-identifier-naming'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114034.387761.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211116/58432755/attachment.bin>
More information about the cfe-commits
mailing list