r361468 - Delete default constructors, copy constructors, move constructors, copy assignment, move assignment operators on Expr, Stmt and Decl
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 02:22:43 PDT 2019
Author: gribozavr
Date: Thu May 23 02:22:43 2019
New Revision: 361468
URL: http://llvm.org/viewvc/llvm-project?rev=361468&view=rev
Log:
Delete default constructors, copy constructors, move constructors, copy assignment, move assignment operators on Expr, Stmt and Decl
Reviewers: ilya-biryukov, rsmith
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62187
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=361468&r1=361467&r2=361468&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu May 23 02:22:43 2019
@@ -368,6 +368,13 @@ private:
return ModuleOwnershipKind::Unowned;
}
+public:
+ Decl() = delete;
+ Decl(const Decl&) = delete;
+ Decl(Decl &&) = delete;
+ Decl &operator=(const Decl&) = delete;
+ Decl &operator=(Decl&&) = delete;
+
protected:
Decl(Kind DK, DeclContext *DC, SourceLocation L)
: NextInContextAndBits(nullptr, getModuleOwnershipKindForChildOf(DC)),
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=361468&r1=361467&r2=361468&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu May 23 02:22:43 2019
@@ -108,6 +108,13 @@ struct SubobjectAdjustment {
class Expr : public ValueStmt {
QualType TR;
+public:
+ Expr() = delete;
+ Expr(const Expr&) = delete;
+ Expr(Expr &&) = delete;
+ Expr &operator=(const Expr&) = delete;
+ Expr &operator=(Expr&&) = delete;
+
protected:
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK,
bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=361468&r1=361467&r2=361468&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu May 23 02:22:43 2019
@@ -1040,6 +1040,12 @@ protected:
explicit Stmt(StmtClass SC, EmptyShell) : Stmt(SC) {}
public:
+ Stmt() = delete;
+ Stmt(const Stmt &) = delete;
+ Stmt(Stmt &&) = delete;
+ Stmt &operator=(const Stmt &) = delete;
+ Stmt &operator=(Stmt &&) = delete;
+
Stmt(StmtClass SC) {
static_assert(sizeof(*this) <= 8,
"changing bitfields changed sizeof(Stmt)");
@@ -1054,11 +1060,6 @@ 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; }
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=361468&r1=361467&r2=361468&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 23 02:22:43 2019
@@ -1134,9 +1134,10 @@ llvm::Function *CodeGenFunction::generat
return F;
llvm::SmallVector<QualType, 4> ArgTys;
- llvm::SmallVector<ImplicitParamDecl, 4> Params;
- Params.emplace_back(Ctx, nullptr, SourceLocation(), &Ctx.Idents.get("buffer"),
- Ctx.VoidPtrTy, ImplicitParamDecl::Other);
+ FunctionArgList Args;
+ Args.push_back(ImplicitParamDecl::Create(
+ Ctx, nullptr, SourceLocation(), &Ctx.Idents.get("buffer"), Ctx.VoidPtrTy,
+ ImplicitParamDecl::Other));
ArgTys.emplace_back(Ctx.VoidPtrTy);
for (unsigned int I = 0, E = Layout.Items.size(); I < E; ++I) {
@@ -1145,17 +1146,13 @@ llvm::Function *CodeGenFunction::generat
continue;
QualType ArgTy = getOSLogArgType(Ctx, Size);
- Params.emplace_back(
+ Args.push_back(ImplicitParamDecl::Create(
Ctx, nullptr, SourceLocation(),
&Ctx.Idents.get(std::string("arg") + llvm::to_string(I)), ArgTy,
- ImplicitParamDecl::Other);
+ ImplicitParamDecl::Other));
ArgTys.emplace_back(ArgTy);
}
- FunctionArgList Args;
- for (auto &P : Params)
- Args.push_back(&P);
-
QualType ReturnTy = Ctx.VoidTy;
QualType FuncionTy = Ctx.getFunctionType(ReturnTy, ArgTys, {});
@@ -1188,7 +1185,7 @@ llvm::Function *CodeGenFunction::generat
auto AL = ApplyDebugLocation::CreateArtificial(*this);
CharUnits Offset;
- Address BufAddr(Builder.CreateLoad(GetAddrOfLocalVar(&Params[0]), "buf"),
+ Address BufAddr(Builder.CreateLoad(GetAddrOfLocalVar(Args[0]), "buf"),
BufferAlignment);
Builder.CreateStore(Builder.getInt8(Layout.getSummaryByte()),
Builder.CreateConstByteGEP(BufAddr, Offset++, "summary"));
@@ -1208,7 +1205,7 @@ llvm::Function *CodeGenFunction::generat
if (!Size.getQuantity())
continue;
- Address Arg = GetAddrOfLocalVar(&Params[I]);
+ Address Arg = GetAddrOfLocalVar(Args[I]);
Address Addr = Builder.CreateConstByteGEP(BufAddr, Offset, "argData");
Addr = Builder.CreateBitCast(Addr, Arg.getPointer()->getType(),
"argDataCast");
More information about the cfe-commits
mailing list