[llvm-commits] [llvm] r80648 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp
Devang Patel
dpatel at apple.com
Mon Aug 31 18:14:15 PDT 2009
Author: dpatel
Date: Mon Aug 31 20:14:15 2009
New Revision: 80648
URL: http://llvm.org/viewvc/llvm-project?rev=80648&view=rev
Log:
Introduce DILocation.
Modified:
llvm/trunk/include/llvm/Analysis/DebugInfo.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=80648&r1=80647&r2=80648&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 31 20:14:15 2009
@@ -471,8 +471,24 @@
const std::string &getDirectory(std::string &D) const {
return getContext().getDirectory(D);
}
+ };
+ /// DILocation - This object holds location information. This object
+ /// is not associated with any DWARF tag.
+ class DILocation : public DIDescriptor {
+ public:
+ explicit DILocation(MDNode *L) { DbgNode = L; }
+ unsigned getLineNumber() const { return getUnsignedField(0); }
+ unsigned getColumnNumber() const { return getUnsignedField(1); }
+ DIScope getScope() const { return getFieldAs<DIScope>(3); }
+ DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
+ std::string getFilename(std::string &F) const {
+ return getScope().getFilename(F);
+ }
+ std::string getDirectory(std::string &D) const {
+ return getScope().getDirectory(D);
+ }
};
/// DIFactory - This object assists with the construction of the various
@@ -575,6 +591,10 @@
/// with the specified parent context.
DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
+ /// CreateLocation - Creates a debug info location.
+ DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
+ DIScope S, DILocation OrigLoc);
+
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
/// inserting it at the end of the specified basic block.
void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=80648&r1=80647&r2=80648&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 31 20:14:15 2009
@@ -791,6 +791,18 @@
return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2));
}
+/// CreateLocation - Creates a debug info location.
+DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
+ DIScope S, DILocation OrigLoc) {
+ Value *Elts[] = {
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
+ ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
+ S.getNode(),
+ OrigLoc.getNode(),
+ };
+ return DILocation(MDNode::get(VMContext, &Elts[0], 4));
+}
+
//===----------------------------------------------------------------------===//
// DIFactory: Routines for inserting code into a function
More information about the llvm-commits
mailing list