[clang] cb63fa0 - [NFC][clang] Fix static analyzer concerns
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 08:49:38 PDT 2023
Author: Podchishchaeva, Mariya
Date: 2023-07-26T08:40:40-07:00
New Revision: cb63fa00d1f723e3b4e2fb5e6645595eb0a6e84c
URL: https://github.com/llvm/llvm-project/commit/cb63fa00d1f723e3b4e2fb5e6645595eb0a6e84c
DIFF: https://github.com/llvm/llvm-project/commit/cb63fa00d1f723e3b4e2fb5e6645595eb0a6e84c.diff
LOG: [NFC][clang] Fix static analyzer concerns
TypeLocBuilder frees resources in the destructor but doesn't have
user-written copy c'tor or assignment operator, so copying it using
default ones can cause double free.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D156222
Added:
Modified:
clang/lib/Sema/TypeLocBuilder.h
Removed:
################################################################################
diff --git a/clang/lib/Sema/TypeLocBuilder.h b/clang/lib/Sema/TypeLocBuilder.h
index d413d74b74ff99..15eb2226cdf7f4 100644
--- a/clang/lib/Sema/TypeLocBuilder.h
+++ b/clang/lib/Sema/TypeLocBuilder.h
@@ -53,6 +53,9 @@ class TypeLocBuilder {
delete[] Buffer;
}
+ TypeLocBuilder(const TypeLocBuilder &) = delete;
+ TypeLocBuilder &operator=(const TypeLocBuilder &) = delete;
+
/// Ensures that this buffer has at least as much capacity as described.
void reserve(size_t Requested) {
if (Requested > Capacity)
More information about the cfe-commits
mailing list