Use llvm.dbg.cu named metadata to collect compile units.

llvm-svn: 130756
This commit is contained in:
Devang Patel 2011-05-03 16:18:28 +00:00
parent 9c373c1c7a
commit 09fa69e151
2 changed files with 7 additions and 1 deletions

View File

@ -342,7 +342,9 @@ height="369">
that produced it.</p>
<p>Compile unit descriptors provide the root context for objects declared in a
specific compilation unit. File descriptors are defined using this context.</p>
specific compilation unit. File descriptors are defined using this context.
These descriptors are collected by a named metadata
<tt>!llvm.dbg.cu</tt>.
</div>

View File

@ -51,6 +51,10 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeVer)
};
TheCU = DICompileUnit(MDNode::get(VMContext, Elts));
// Create a named metadata so that it is easier to find cu in a module.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
NMD->addOperand(TheCU);
}
/// createFile - Create a file descriptor to hold debugging information