我需要从现有的MDNode创建一个DIVariable。
根据documentation的说法,DIVariable继承自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 {我试着更进一步,从MDNode创建一个DINode,看看是否能正常工作,这给出了一个类似的错误:
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 {这个错误对我来说没有任何意义。继承自另一个类的类如何不隐式地转换为它?
发布于 2019-10-09 23:40:09
为将来搜索的任何人找到了答案。
为了支持cast<>, isa<>, and dyn_cast<>,In r234255删除了许多隐式复制构造函数。
https://stackoverflow.com/questions/58295105
复制相似问题