Author: Podchishchaeva, Mariya Date: 2023-08-03T08:37:58-07:00 New Revision: 25d6f9ddc1913de1094fa610ce77288f337771a2
URL: https://github.com/llvm/llvm-project/commit/25d6f9ddc1913de1094fa610ce77288f337771a2 DIFF: https://github.com/llvm/llvm-project/commit/25d6f9ddc1913de1094fa610ce77288f337771a2.diff LOG: [NFC][clang] Fix static analyzer concerns A bunch of classes in APValue free resources in the destructor but don't have user-written copy c'tor or assignment operator, so copying them using default ones can cause double free. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D156975 Added: Modified: clang/include/clang/AST/APValue.h Removed: ################################################################################ diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h index 286c1a1b0941ae..c4206b73b11562 100644 --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -270,12 +270,16 @@ class APValue { APValue *Elts = nullptr; unsigned NumElts = 0; Vec() = default; + Vec(const Vec &) = delete; + Vec &operator=(const Vec &) = delete; ~Vec() { delete[] Elts; } }; struct Arr { APValue *Elts; unsigned NumElts, ArrSize; Arr(unsigned NumElts, unsigned ArrSize); + Arr(const Arr &) = delete; + Arr &operator=(const Arr &) = delete; ~Arr(); }; struct StructData { @@ -283,12 +287,16 @@ class APValue { unsigned NumBases; unsigned NumFields; StructData(unsigned NumBases, unsigned NumFields); + StructData(const StructData &) = delete; + StructData &operator=(const StructData &) = delete; ~StructData(); }; struct UnionData { const FieldDecl *Field; APValue *Value; UnionData(); + UnionData(const UnionData &) = delete; + UnionData &operator=(const UnionData &) = delete; ~UnionData(); }; struct AddrLabelDiffData { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits