summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitf032c956de59891e0c64e8d85a3f68533ddc8de6 (patch)
tree73984488d7af4aed24bcc036ecaf3cc492b7e41b /llvm/docs/SourceLevelDebugging.rst
parent14c3c4bb85e9a2fb8178a09981a0310c997e9ffc (diff)
downloadbcm5719-llvm-f032c956de59891e0c64e8d85a3f68533ddc8de6.tar.gz
bcm5719-llvm-f032c956de59891e0c64e8d85a3f68533ddc8de6.zip
Update docs for accessing !dbg attachments
llvm-svn: 244238
Diffstat (limited to 'llvm/docs/SourceLevelDebugging.rst')
-rw-r--r--llvm/docs/SourceLevelDebugging.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/docs/SourceLevelDebugging.rst b/llvm/docs/SourceLevelDebugging.rst
index 67b81c61d8a..b98fd33002a 100644
--- a/llvm/docs/SourceLevelDebugging.rst
+++ b/llvm/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
OpenPOWER on IntegriCloud