llvm-project
2566961c - [clang-tidy] use-after-move: Support null_after_move annotations (#186903)

Commit
39 days ago
[clang-tidy] use-after-move: Support null_after_move annotations (#186903) Extend the bugprone-use-after-move check to recognize user defined smart-pointer-like types that make guarantees on the state of a moved-from object, leaving it in a valid and specified state that matches the standard smart pointer's moved-from state (nullptr), where it is safe to use but not dereference. Following the RFC discussion: * Use `[[clang::annotate]]` to mark the types. * Use an schema for the `[[clang::annotate]]` annotation and arguments to help avoid conflicts with other users of the attribute. * The annotation will identify the tool ("clang-tidy") and the arguments the plugin ("bugprone-use-after-move"), and the behavior of the type ("null_after_move"). E.g.: `[[clang::annotate("clang-tidy", "bugprone-use-after-move", "null_after_move")]]` RFC: https://discourse.llvm.org/t/rfc-add-a-class-attribute-clang-null-after-move-for-use-after-move-analysis/89760
Author
Parents
Loading