DebugInfo: provide the ability to add members to a class after it has been constructed
This is necessary to allow Clang to only emit implicit members when there is code generated for them, rather than whenever they are ODR used. llvm-svn: 188082
This commit is contained in:
parent
eeeb4828bb
commit
f103c2f946
|
@ -323,6 +323,7 @@ namespace llvm {
|
||||||
|
|
||||||
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
|
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
|
||||||
void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
|
void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
|
||||||
|
void addMember(DISubprogram S);
|
||||||
unsigned getRunTimeLang() const { return getUnsignedField(11); }
|
unsigned getRunTimeLang() const { return getUnsignedField(11); }
|
||||||
DICompositeType getContainingType() const {
|
DICompositeType getContainingType() const {
|
||||||
return getFieldAs<DICompositeType>(12);
|
return getFieldAs<DICompositeType>(12);
|
||||||
|
|
|
@ -647,6 +647,19 @@ void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {
|
||||||
DbgNode = N;
|
DbgNode = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DICompositeType::addMember(DISubprogram S) {
|
||||||
|
SmallVector<llvm::Value *, 16> M;
|
||||||
|
DIArray OrigM = getTypeArray();
|
||||||
|
unsigned Elements = OrigM.getNumElements();
|
||||||
|
if (Elements == 1 && !OrigM.getElement(0))
|
||||||
|
Elements = 0;
|
||||||
|
M.reserve(Elements + 1);
|
||||||
|
for (unsigned i = 0; i != Elements; ++i)
|
||||||
|
M.push_back(OrigM.getElement(i));
|
||||||
|
M.push_back(S);
|
||||||
|
setTypeArray(DIArray(MDNode::get(DbgNode->getContext(), M)));
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Set the containing type.
|
/// \brief Set the containing type.
|
||||||
void DICompositeType::setContainingType(DICompositeType ContainingType) {
|
void DICompositeType::setContainingType(DICompositeType ContainingType) {
|
||||||
TrackingVH<MDNode> N(*this);
|
TrackingVH<MDNode> N(*this);
|
||||||
|
|
Loading…
Reference in New Issue