aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaConcept.cpp
diff options
context:
space:
mode:
authorShafik Yaghmour <shafik.yaghmour@intel.com>2025-05-14 07:31:14 -0700
committerGitHub <noreply@github.com>2025-05-14 07:31:14 -0700
commit7e690db5157bfda1a2be3a99d16e8875a2d42b96 (patch)
tree6dce05b7896abe4c63d96a2771621676b5514169 /clang/lib/Sema/SemaConcept.cpp
parent3302f9f63d1cba91b260212992caf6c895582f3b (diff)
downloadllvm-7e690db5157bfda1a2be3a99d16e8875a2d42b96.zip
llvm-7e690db5157bfda1a2be3a99d16e8875a2d42b96.tar.gz
llvm-7e690db5157bfda1a2be3a99d16e8875a2d42b96.tar.bz2
[Clang][NFC] Introduce no local variable to avoid use after move (#139784)
Static analysis flagged the use of Left.size() because we just moved out of Left and that would be undefined behavior. Fix is to take the size and store it in a local variable instead.
Diffstat (limited to 'clang/lib/Sema/SemaConcept.cpp')
-rw-r--r--clang/lib/Sema/SemaConcept.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 15b9c97..543bd45 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1999,8 +1999,9 @@ FormulaType SubsumptionChecker::Normalize(const NormalizedConstraint &NC) {
});
if (NC.getCompoundKind() == FormulaType::Kind) {
+ auto SizeLeft = Left.size();
Res = std::move(Left);
- Res.reserve(Left.size() + Right.size());
+ Res.reserve(SizeLeft + Right.size());
std::for_each(std::make_move_iterator(Right.begin()),
std::make_move_iterator(Right.end()), Add);
return Res;