diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-08-09 17:17:12 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-08-09 17:17:12 +0000 |
commit | f103c2f946abebffeea9f033c0393866d0d1f6a2 (patch) | |
tree | 1f10a72b161b5fd21b78a8d0a067913d62bc6880 /llvm/lib/IR/DebugInfo.cpp | |
parent | eeeb4828bbcd39e10f7d3acdef6a8f3fcc78c84b (diff) | |
download | bcm5719-llvm-f103c2f946abebffeea9f033c0393866d0d1f6a2.tar.gz bcm5719-llvm-f103c2f946abebffeea9f033c0393866d0d1f6a2.zip |
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
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index fc9324949d0..0f7ddb5961c 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -647,6 +647,19 @@ void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) { 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. void DICompositeType::setContainingType(DICompositeType ContainingType) { TrackingVH<MDNode> N(*this); |