[llvm] r244238 - Update docs for accessing !dbg attachments
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 11:15:26 PDT 2015
Author: dexonsmith
Date: Thu Aug 6 13:15:25 2015
New Revision: 244238
URL: http://llvm.org/viewvc/llvm-project?rev=244238&view=rev
Log:
Update docs for accessing !dbg attachments
Modified:
llvm/trunk/docs/SourceLevelDebugging.rst
Modified: llvm/trunk/docs/SourceLevelDebugging.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/SourceLevelDebugging.rst?rev=244238&r1=244237&r2=244238&view=diff
==============================================================================
--- llvm/trunk/docs/SourceLevelDebugging.rst (original)
+++ llvm/trunk/docs/SourceLevelDebugging.rst Thu Aug 6 13:15:25 2015
@@ -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
More information about the llvm-commits
mailing list