<div dir="ltr">Hello,<div><br></div><div>I am working on upgrading LLVM libraries from 3.0 to 7.0.0 for a project to be compatible with an outside project.</div><div><br></div><div>I've made good progress but am running into a wall for all things related to DIVariables and there creation from existing Metadata objects.</div><div><br></div><div>Specifically I've run into 3 issues;</div><div><br></div><div>(1)I am trying to create a DIType from the Type of an existing DIVariable using getType().</div><div><br></div><div>foo (DIVariable& oldDIVar){</div><div><br></div><div>    const DIType oldDIType = oldDIVar.getType();</div><div>}</div><div><br></div><div>According to the llvm documentation, DIVariable::getType should return a DIType*. But I get an error message:</div><div><br></div><div>error: no viable conversion from 'llvm::DITypeRef' (aka 'TypedDINodeRef<llvm::DIType>') to 'const llvm::DIType *'<br>  const DIType *oldDIType = oldDIVar.getType();<br>                ^           ~~~~~~~~~~~~~~~~~~<br></div><div><br></div><div>I've messed around with dereferencing the oldDIVar variable, which points to the underlying Metadata of it. I would assume that attempting to create a DIType from pure metadata would be fine, since it inherits from the metadata class. But I always get the error:</div><div><br></div><div> error: no viable conversion from 'llvm::Metadata' to 'llvm::DIType'<br>  DIType oldDIType = *oldDIVar.getType();<br>         ^           ~~~~~~~~~~~~~~~~~~~<br>/root/llvm-7.0.0/include/llvm/IR/DebugInfoMetadata.h:630:7: note: candidate constructor (the implicit copy constructor) not viable: cannot bind base class object of type 'llvm::Metadata' to derived class<br>      reference 'const llvm::DIType &' for 1st argument<br>class DIType : public DIScope {<br></div><div><div><br></div><div>Am I missing something about inheritance that prevents this?</div><div><br></div><div>(2)One of the other errors is similar;</div><div><br></div><div>  Unable to convert from MDNode to DIVariable</div><div><br></div><div>(3)The final one is strange to me. Once again trying to make a DIVariable from and oldDIVar,</div><div>this time calling DbgVariables::getVariables(). I try to call it as such;</div><div><br></div><div>DIVariable oldDIVar(*(oldDeclare->getVariable());</div><div><br></div><div>But that seems to give an error due to an implicitly deleted copy constructor, which completely baffles me.</div><div><br></div><div>error: call to implicitly-deleted copy constructor of 'llvm::DIVariable'<br>                  DIVariable oldDIVar(*(oldDeclare->getVariable()));<br></div><div><br></div><div><br></div><div>If anyone could provide insight into why creating DIVariables and DITypes is failing, and what the implicitly deleted copy constructor is being caused by, I'd really appreciate it.</div><div><br></div><div>This is my first time using this mailing list, so apologies of I made a mistake somewhere.</div><div><br></div>Regards,</div><div><br></div><div>Trevor</div></div>