From e7e6841bf8eb929dcf9445ec9cea1f14c581bff0 Mon Sep 17 00:00:00 2001 From: Bruno Ricci Date: Fri, 12 Apr 2019 13:26:55 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358283 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Stmt.h | 5 +++++ include/clang/AST/Type.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index ff6c18c44f..563a4f92ba 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -1042,6 +1042,11 @@ public: return static_cast(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; } diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index cbc05a1a73..12a0213fdd 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -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(TypeBits.TC); } -- 2.40.0