未验证 提交 4c5ce835 编写于 作者: A Aurelius84 提交者: GitHub

[NewIR]Disable copy and assign for Operation (#55328)

* [NewIR]Disable copy and assign for Operation

* add macros.h
上级 1558ee02
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
namespace ir {
// TODO(Aurelius84): We also has DISABLE_COPY_AND_ASSIGN in phi/core/maros.h,
// howere it's not recommended to use it in ir namspace. So we define this again
// here.
// Disable the copy and assignment operator for a class.
#ifndef DISABLE_COPY_AND_ASSIGN
#define DISABLE_COPY_AND_ASSIGN(classname) \
private: \
classname(const classname&) = delete; \
classname(classname&&) = delete; \
classname& operator=(const classname&) = delete; \
classname& operator=(classname&&) = delete
#endif
} // namespace ir
......@@ -17,6 +17,7 @@
#include <ostream>
#include <vector>
#include "paddle/ir/core/block.h"
#include "paddle/ir/core/macros.h"
#include "paddle/ir/core/op_info.h"
#include "paddle/ir/core/operation_utils.h"
#include "paddle/ir/core/type.h"
......@@ -122,6 +123,7 @@ class IR_API alignas(8) Operation final {
void Verify();
private:
DISABLE_COPY_AND_ASSIGN(Operation);
Operation(const AttributeMap &attribute,
ir::OpInfo op_info,
uint32_t num_results,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册