[C++11] Make StoredDeclsList move-only.

It is only moved when a StoredDeclsMap grows.

llvm-svn: 202859
This commit is contained in:
Benjamin Kramer 2014-03-04 16:42:46 +00:00
parent afd8d16bce
commit b99c6b5d94
1 changed files with 4 additions and 7 deletions

View File

@ -46,10 +46,8 @@ struct StoredDeclsList {
public:
StoredDeclsList() {}
StoredDeclsList(const StoredDeclsList &RHS) : Data(RHS.Data) {
if (DeclsTy *RHSVec = RHS.getAsVector())
Data = DeclsAndHasExternalTy(new DeclsTy(*RHSVec),
RHS.hasExternalDecls());
StoredDeclsList(StoredDeclsList &&RHS) : Data(RHS.Data) {
RHS.Data = (NamedDecl *)0;
}
~StoredDeclsList() {
@ -58,12 +56,11 @@ public:
delete Vector;
}
StoredDeclsList &operator=(const StoredDeclsList &RHS) {
StoredDeclsList &operator=(StoredDeclsList &&RHS) {
if (DeclsTy *Vector = getAsVector())
delete Vector;
Data = RHS.Data;
if (DeclsTy *RHSVec = RHS.getAsVector())
Data = DeclsAndHasExternalTy(new DeclsTy(*RHSVec), hasExternalDecls());
RHS.Data = (NamedDecl *)0;
return *this;
}