llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[clang-tidy] Add `ReinitializationFunctions` option to `bugprone-use-after-move`

Open zeyi2 opened this issue 4 weeks ago • 1 comments

Recently, this PR introduces the InvalidationFunctions option to bugprone-use-after-move check , which allows users to specify custom functions that invalidate an object.

Currently, the check only recognizes reinitialization via Assignment (operator=), library functions (std::vector::clear, std::unique_ptr::reset) and functions annotated with [[clang::reinitializes]].

It would be beneficial to add a ReinitializationFunctions option, which allows users to specify methods that effectively re-initialize a moved-from object.

This option will be useful when dealing with third-party libraries/legacy codebase where mass updating [[clang::reinitializes]] attribute is not feasible.

zeyi2 avatar Dec 04 '25 10:12 zeyi2

@llvm/issue-subscribers-clang-tidy

Author: mitchell (zeyi2)

Recently, [this PR](https://github.com/llvm/llvm-project/pull/170346) introduces the `InvalidationFunctions` option to `bugprone-use-after-move` check , which allows users to specify custom functions that invalidate an object.

Currently, the check only recognizes reinitialization via Assignment (operator=), library functions (std::vector::clear, std::unique_ptr::reset) and functions annotated with [[clang::reinitializes]].

It would be beneficial to add a ReinitializationFunctions option, which allows users to specify methods that effectively re-initialize a moved-from object.

This option will be useful when dealing with third-party libraries/legacy codebase where mass updating [[clang::reinitializes]] attribute is not feasible.

llvmbot avatar Dec 04 '25 10:12 llvmbot