Update docs for accessing !dbg attachments
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 6 Aug 2015 18:15:25 +0000 (18:15 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 6 Aug 2015 18:15:25 +0000 (18:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244238 91177308-0d34-0410-b5e6-96231b3b80d8

docs/SourceLevelDebugging.rst

index 67b81c61d8a3b52c563d7773560a3609ee0bf990..b98fd33002a40600944ff18e85c0f2ead85af5d5 100644 (file)
@@ -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