[llvm] r209832 - [ADT] Delete the Twine assignment operator

Reid Kleckner reid at kleckner.net
Thu May 29 10:12:05 PDT 2014


Author: rnk
Date: Thu May 29 12:12:05 2014
New Revision: 209832

URL: http://llvm.org/viewvc/llvm-project?rev=209832&view=rev
Log:
[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!

Modified:
    llvm/trunk/include/llvm/ADT/Twine.h

Modified: llvm/trunk/include/llvm/ADT/Twine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=209832&r1=209831&r2=209832&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Twine.h (original)
+++ llvm/trunk/include/llvm/ADT/Twine.h Thu May 29 12:12:05 2014
@@ -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;





More information about the llvm-commits mailing list