summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-05-03 16:18:28 +0000
committerDevang Patel <dpatel@apple.com>2011-05-03 16:18:28 +0000
commit464f4ef2bdb47a44ffa2c4208296da641db7358d (patch)
tree9a479758f10da8c511f9477f6a90d1be4cd50d6b
parentd2189bf12af59fa59aef375ce05d4ba9122ca287 (diff)
downloadllvm-464f4ef2bdb47a44ffa2c4208296da641db7358d.tar.gz
llvm-464f4ef2bdb47a44ffa2c4208296da641db7358d.tar.bz2
llvm-464f4ef2bdb47a44ffa2c4208296da641db7358d.tar.xz
Use llvm.dbg.cu named metadata to collect compile units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130756 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/SourceLevelDebugging.html4
-rw-r--r--lib/Analysis/DIBuilder.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/docs/SourceLevelDebugging.html b/docs/SourceLevelDebugging.html
index c9ae0202de..4c4439fd59 100644
--- a/docs/SourceLevelDebugging.html
+++ b/docs/SourceLevelDebugging.html
@@ -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>
diff --git a/lib/Analysis/DIBuilder.cpp b/lib/Analysis/DIBuilder.cpp
index dc98c9e67a..1375e497ac 100644
--- a/lib/Analysis/DIBuilder.cpp
+++ b/lib/Analysis/DIBuilder.cpp
@@ -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