r358283 - [AST] Forbid copy/move of statements/types

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 06:26:55 PDT 2019


Author: brunoricci
Date: Fri Apr 12 06:26:55 2019
New Revision: 358283

URL: http://llvm.org/viewvc/llvm-project?rev=358283&view=rev
Log:
[AST] Forbid copy/move of statements/types

Statements, expressions and types are not supposed to be copied/moved,
and trying to do so is only going to result in tears. Someone tripped
on this a few days ago on the mailing list. NFC.

Differential Revision: https://reviews.llvm.org/D60123

Reviewed By: aaron.ballman


Modified:
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=358283&r1=358282&r2=358283&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Fri Apr 12 06:26:55 2019
@@ -1042,6 +1042,11 @@ public:
     return static_cast<StmtClass>(StmtBits.sClass);
   }
 
+  Stmt(const Stmt &) = delete;
+  Stmt(Stmt &&) = delete;
+  Stmt &operator=(const Stmt &) = delete;
+  Stmt &operator=(Stmt &&) = delete;
+
   const char *getStmtClassName() const;
 
   bool isOMPStructuredBlock() const { return StmtBits.IsOMPStructuredBlock; }

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=358283&r1=358282&r2=358283&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Apr 12 06:26:55 2019
@@ -1813,7 +1813,9 @@ public:
   friend class ASTWriter;
 
   Type(const Type &) = delete;
+  Type(Type &&) = delete;
   Type &operator=(const Type &) = delete;
+  Type &operator=(Type &&) = delete;
 
   TypeClass getTypeClass() const { return static_cast<TypeClass>(TypeBits.TC); }
 




More information about the cfe-commits mailing list