Add CreateLocation varinat that accepts MDNode (with a default value).
authorDevang Patel <dpatel@apple.com>
Mon, 23 Nov 2009 19:11:20 +0000 (19:11 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 23 Nov 2009 19:11:20 +0000 (19:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89689 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp

index 3c40d65a485a1020353512119108aaa0bde84896..aa99a133f2a65cf461f484c06e2a8091f7535247 100644 (file)
@@ -598,6 +598,10 @@ namespace llvm {
     DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
                               DIScope S, DILocation OrigLoc);
 
+    /// CreateLocation - Creates a debug info location.
+    DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
+                              DIScope S, MDNode *OrigLoc = 0);
+
     /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
     Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
                                BasicBlock *InsertAtEnd);
index 8f62245296f5efd3ff7a5cf6927ad72d54a1cf19..1a079b950a19b6b7bdb3b3fafcf8442042595351 100644 (file)
@@ -976,6 +976,17 @@ DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
   return DILocation(MDNode::get(VMContext, &Elts[0], 4));
 }
 
+/// CreateLocation - Creates a debug info location.
+DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
+                                     DIScope S, MDNode *OrigLoc) {
+ Value *Elts[] = {
+    ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
+    ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
+    S.getNode(),
+    OrigLoc
+  };
+  return DILocation(MDNode::get(VMContext, &Elts[0], 4));
+}
 
 //===----------------------------------------------------------------------===//
 // DIFactory: Routines for inserting code into a function