summaryrefslogtreecommitdiff
path: root/docs/SourceLevelDebugging.rst
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-06 18:15:25 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-06 18:15:25 +0000
commit66353e36b98658007761a11279feb65db760e70b (patch)
tree8f81235bcb74b3ac20ec0a1cdc5cda505e0aa6bc /docs/SourceLevelDebugging.rst
parent87433fc81a9f156bf94625ee7a9237983db7a38a (diff)
Update docs for accessing !dbg attachments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/SourceLevelDebugging.rst')
-rw-r--r--docs/SourceLevelDebugging.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/SourceLevelDebugging.rst b/docs/SourceLevelDebugging.rst
index 67b81c61d8a..b98fd33002a 100644
--- a/docs/SourceLevelDebugging.rst
+++ b/docs/SourceLevelDebugging.rst
@@ -368,15 +368,14 @@ C/C++ source file information
``llvm::Instruction`` provides easy access to metadata attached with an
instruction. One can extract line number information encoded in LLVM IR using
-``Instruction::getMetadata()`` and ``DILocation::getLineNumber()``.
+``Instruction::getDebugLoc()`` and ``DILocation::getLine()``.
.. code-block:: c++
- if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
- DILocation Loc(N); // DILocation is in DebugInfo.h
- unsigned Line = Loc.getLineNumber();
- StringRef File = Loc.getFilename();
- StringRef Dir = Loc.getDirectory();
+ if (DILocation *Loc = I->getDebugLoc()) { // Here I is an LLVM instruction
+ unsigned Line = Loc->getLine();
+ StringRef File = Loc->getFilename();
+ StringRef Dir = Loc->getDirectory();
}
C/C++ global variable information