A semicolon-separated list of the names of functions or methods to be considered as not having side-effects was added for bugprone-assert-side-effect.
It can be used to exclude methods like iterator::begin/end from being considered as having side-effects.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
169 | I introduced those double backticks due to review comments. As it turns out, single backticks are only for links, not for formatted text. Should they be brought back? |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
169 | Double back-ticks are for language constructs, single back-ticks for options, tool names, etc. |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
169 | Hm, I see. I think visually it's much more helpful to have options rendered as formatted code (just like you'd see them in the .clang-tidy file in a code editor) instead of in italic, which is what is rendered with single backticks. |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
169 | Also note that the main clang-tidy doc page uses doble backticks for options, not just language constructs, so I think it would be good to keep consistency with that: https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/docs/clang-tidy/index.rst Single backticks are used there only for links and together with the :program: keyword. |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
169 | Unless there's some documented style convention that says otherwise, of course. I haven't found anything in the LLVM Coding Standards. |
clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.h | ||
---|---|---|
36–47 | Instead of using "Exception" here, can we rename slightly? Functions can have lists of exceptions (dynamic exception specifications are a thing in C++), so the use of "exception" can be somewhat confusing, but I think something like IgnoredFunctionList and IgnoredFunctions would be an improvement. |
clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp | ||
---|---|---|
60–64 | This doesn't seem quite right to me (test coverage would help) in the case where the user is specifying a (potentially partially) qualified function name. e.g., imagine an IgnoredFunctions list of my::fancy_func,::other_func,yet::another_func where my is a namespace containing a function named fancy_func, and yet is a class with a static function named another_func. I think this code will only consider the name of the function itself, but not any part of its qualified name. I think we typically implement function name exclusions via the matchesAnyListedName() AST matcher, as in: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp#L92 | |
clang-tools-extra/docs/ReleaseNotes.rst | ||
171–172 | ||
clang-tools-extra/docs/clang-tidy/checks/bugprone-assert-side-effect.rst | ||
27 | This doesn't document whether the names can be qualified or not, or whether the names have to have an exact match instead of a regex match. | |
clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp | ||
99 | FWIW, I think this can be confusing in practice; the function called is ::MyClass:badButIgnoredFunc(). Further, if I had a global function named badButIgnoredFunc() it would *also* be ignored and I'd have no way to configure to distinguish between the two. |
clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp | ||
---|---|---|
60–64 | Thanks a lot! BTW, now we have "," separator for macros and ";" for ignored functions. Doesn't sound reasonable. What do you think? | |
clang-tools-extra/test/clang-tidy/checkers/bugprone-assert-side-effect.cpp | ||
99 | Added a new test case for it. |
LGTM aside from a nit in the documentation.
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
172 |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
172 | Thanks! Fixed and pushed. |
I don't think this included is needed?