[all-commits] [llvm/llvm-project] c3e3c7: [clang-tidy] Fix `bugprone-use-after-move` check t...
FabianWolff via All-commits
all-commits at lists.llvm.org
Sun Nov 14 23:43:09 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c3e3c762098e8d425731bb40f3b8b04dac1013f3
https://github.com/llvm/llvm-project/commit/c3e3c762098e8d425731bb40f3b8b04dac1013f3
Author: Fabian Wolff <fabian.wolff at alumni.ethz.ch>
Date: 2021-11-15 (Mon, 15 Nov 2021)
Changed paths:
M clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
M clang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp
Log Message:
-----------
[clang-tidy] Fix `bugprone-use-after-move` check to also consider moves in constructor initializers
Fixes PR#38187. Constructors are actually already checked,
but only as functions, i.e. the check only looks at the
constructor body and not at the initializers, which misses
the (common) case where constructor parameters are moved
as part of an initializer expression.
One remaining false negative is when both the move //and//
the use-after-move occur in constructor initializers.
This is a lot more difficult to handle, though, because
the `bugprone-use-after-move` check is currently based on
a CFG that only takes the body into account, not the
initializers, so e.g. initialization order would have to
manually be considered. I will file a follow-up issue for
this once PR#38187 is closed.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D113708
More information about the All-commits
mailing list