[all-commits] [llvm/llvm-project] 12a999: [clang-tidy] Prevent false-positive in presence of...
serge-sans-paille via All-commits
all-commits at lists.llvm.org
Fri Apr 17 15:04:13 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 12a9996192f66e7b3b5534b43e50b2e387214097
https://github.com/llvm/llvm-project/commit/12a9996192f66e7b3b5534b43e50b2e387214097
Author: serge-sans-paille <sguelton at mozilla.com>
Date: 2026-04-17 (Fri, 17 Apr 2026)
Changed paths:
M clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
M clang-tools-extra/docs/ReleaseNotes.rst
A clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move-derived-to-base.cpp
Log Message:
-----------
[clang-tidy] Prevent false-positive in presence of derived-to-base cast in bugprone.use-after-move (#189638)
The following scenario is quite common, but was reported as a
use-after-move:
```cpp
struct Base {
Base(Base&&);
};
struct C : Base {
int field;
C(C&& c) :
Base(std::move(c)), // << only moves through the base type
field(c.field) // << this is a valid use-after-move
{}
};
```
Fix this by checking field origin when the moved value is immediately
cast to base.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list