[PATCH] D60123: [AST] Forbid copy/move of Stmt.

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 2 05:49:28 PDT 2019


riccibruno created this revision.
riccibruno added a reviewer: aaron.ballman.
riccibruno added a project: clang.
Herald added a subscriber: cfe-commits.

Statements and expressions are not supposed to be 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.


Repository:
  rC Clang

https://reviews.llvm.org/D60123

Files:
  include/clang/AST/Stmt.h


Index: include/clang/AST/Stmt.h
===================================================================
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -1042,6 +1042,11 @@
     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; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60123.193261.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190402/6ca003cc/attachment.bin>


More information about the cfe-commits mailing list