[llvm] 3706c12 - Prevent copying of ArenaAllocator (#97935)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 09:04:20 PDT 2024
Author: smanna12
Date: 2024-07-16T11:04:16-05:00
New Revision: 3706c12c8e2df3bae7ba27ba4645f6eef000bab4
URL: https://github.com/llvm/llvm-project/commit/3706c12c8e2df3bae7ba27ba4645f6eef000bab4
DIFF: https://github.com/llvm/llvm-project/commit/3706c12c8e2df3bae7ba27ba4645f6eef000bab4.diff
LOG: Prevent copying of ArenaAllocator (#97935)
This patch removes copy constructor and assignment operator from
ArenaAllocator class to prevent resource duplication and ensure it
remains non-copyable as per design intent.
Added:
Modified:
llvm/include/llvm/Demangle/MicrosoftDemangle.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangle.h b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
index 1529b803debe5..6891185a28e57 100644
--- a/llvm/include/llvm/Demangle/MicrosoftDemangle.h
+++ b/llvm/include/llvm/Demangle/MicrosoftDemangle.h
@@ -54,6 +54,10 @@ class ArenaAllocator {
}
}
+ // Delete the copy constructor and the copy assignment operator.
+ ArenaAllocator(const ArenaAllocator &) = delete;
+ ArenaAllocator &operator=(const ArenaAllocator &) = delete;
+
char *allocUnalignedBuffer(size_t Size) {
assert(Head && Head->Buf);
More information about the llvm-commits
mailing list