From fa680483220afac65be435ccf3b70051eb7815d3 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 29 May 2014 17:12:05 +0000 Subject: [PATCH] [ADT] Delete the Twine assignment operator This makes it slightly harder to misuse Twines. It is still possible to refer to destroyed temporaries with the regular constructors, though. Patch by Marco Alesiani! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209832 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/Twine.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/llvm/ADT/Twine.h b/include/llvm/ADT/Twine.h index a54fd743ad6..4be3ee6f82d 100644 --- a/include/llvm/ADT/Twine.h +++ b/include/llvm/ADT/Twine.h @@ -182,6 +182,10 @@ namespace llvm { assert(isValid() && "Invalid twine!"); } + /// Since the intended use of twines is as temporary objects, assignments + /// when concatenating might cause undefined behavior or stack corruptions + Twine &operator=(const Twine &Other) LLVM_DELETED_FUNCTION; + /// isNull - Check for the null twine. bool isNull() const { return getLHSKind() == NullKind;