]> granicus.if.org Git - clang/commitdiff
[AST] Forbid copy/move of statements/types
authorBruno Ricci <riccibrun@gmail.com>
Fri, 12 Apr 2019 13:26:55 +0000 (13:26 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Fri, 12 Apr 2019 13:26:55 +0000 (13:26 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358283 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
include/clang/AST/Type.h

index ff6c18c44f07dfc27ff492142304142dc0680d37..563a4f92baa33837fabe3e9fc2822d1c080bf58a 100644 (file)
@@ -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; }
index cbc05a1a732fc11f10b80c4896c1230bab43f427..12a0213fddf8fb166af270491f34f0c29891a9a8 100644 (file)
@@ -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); }