[PATCH] D133244: [clang-tidy] Readability-container-data-pointer adds new option to ignore Containers
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 6 12:00:43 PDT 2023
PiotrZSL requested changes to this revision.
PiotrZSL added a comment.
This revision now requires changes to proceed.
Overall ok, but:
- add storeOptions method
- clarify documentation for added option
- consider supporting regexes
- simplify tests, to avoid duplicating warning message
================
Comment at: clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.cpp:36
cxxRecordDecl(
+ unless(hasAnyName(IgnoredContainers)),
isSameOrDerivedFrom(
----------------
consider using matchers::matchesAnyListedName to support regexes
================
Comment at: clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.h:39
return TK_IgnoreUnlessSpelledInSource;
}
+
----------------
missing storeOptions method, config option wont be saved properly.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst:20
+
+ Semicolon-separated list of containers for which container-data-pointer check won't be enforced
----------------
separated list of what ? regexp ? fully qualified names ? names ? What is default value.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp:63-66
+ // CHECK-MESSAGES-CLASSIC: :[[@LINE-1]]:5: warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
+ // CHECK-FIXES-CLASSIC: {{^ }}f(b.data());{{$}}
+ // CHECK-MESSAGES-WITH-CONFIG: :[[@LINE-3]]:5: warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
+ // CHECK-FIXES-WITH-CONFIG: {{^ }}f(b.data());{{$}}
----------------
instead of duplicating warning use `-check-suffixes=,IGNORED`
look into other checks who they do that loop-convert-reverse.cpp is good example
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133244/new/
https://reviews.llvm.org/D133244
More information about the cfe-commits
mailing list