LLVM MDNode继承

问题描述 投票:0回答:1

我需要从现有的DIVariable创建一个MDNode

根据documentationDIVariable继承自MDNode。但是直接尝试创建会产生错误:

error: no matching constructor for initialization of 'llvm::DIVariable'
                  DIVariable newDIVar(*newMDNode);
                             ^        ~~~~~~~~~~
/root/llvm-7.0.0/include/llvm/IR/DebugInfoMetadata.h:2193:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'llvm::MDNode' to 'const llvm::DIVariable' for 1st
      argument
class DIVariable : public DINode {

我尝试进一步升级并从DINode创建一个MDNode以查看是否有效,这给出了类似的错误:

error: no matching constructor for initialization of 'llvm::DINode'
                  DINode newDINode(*newMDNode);
                         ^         ~~~~~~~~~~
/root/llvm-7.0.0/include/llvm/IR/DebugInfoMetadata.h:155:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'llvm::MDNode' to 'const llvm::DINode' for 1st
      argument
class DINode : public MDNode {

那个错误对我来说毫无意义。从另一个继承的类如何不隐式转换为它?

c++ inheritance llvm
1个回答
0
投票

为将来搜索的人找到了答案。

[In r234255许多隐式副本构造函数已被删除,而偏向cast<>, isa<>, and dyn_cast<>

© www.soinside.com 2019 - 2024. All rights reserved.