Skip to content

Commit

Permalink
[AST] Forbid copy/move of statements/types
Browse files Browse the repository at this point in the history
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
  • Loading branch information
riccibruno committed Apr 12, 2019
1 parent 6df76a3 commit e7e6841
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,11 @@ class alignas(void *) Stmt {
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; }
Expand Down
2 changes: 2 additions & 0 deletions include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,9 @@ class Type : public ExtQualsTypeCommonBase {
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); }

Expand Down

0 comments on commit e7e6841

Please sign in to comment.