[llvm] r177486 - Provide more details for DINameSpace debug info in the IR comment annotations

David Blaikie dblaikie at gmail.com
Tue Mar 19 22:14:14 PDT 2013


Author: dblaikie
Date: Wed Mar 20 00:14:14 2013
New Revision: 177486

URL: http://llvm.org/viewvc/llvm-project?rev=177486&view=rev
Log:
Provide more details for DINameSpace debug info in the IR comment annotations

Sorry for the version skew - I should've committed this before the
corresponding Clang test case.

Modified:
    llvm/trunk/include/llvm/DebugInfo.h
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=177486&r1=177485&r2=177486&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Wed Mar 20 00:14:14 2013
@@ -640,6 +640,8 @@ namespace llvm {
 
   /// DINameSpace - A wrapper for a C++ style name space.
   class DINameSpace : public DIScope {
+    friend class DIDescriptor;
+    void printInternal(raw_ostream &OS) const;
   public:
     explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
     DIScope getContext() const     { return getFieldAs<DIScope>(1);      }

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=177486&r1=177485&r2=177486&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Mar 20 00:14:14 2013
@@ -1033,6 +1033,8 @@ void DIDescriptor::print(raw_ostream &OS
     DIVariable(DbgNode).printInternal(OS);
   } else if (this->isObjCProperty()) {
     DIObjCProperty(DbgNode).printInternal(OS);
+  } else if (this->isNameSpace()) {
+    DINameSpace(DbgNode).printInternal(OS);
   } else if (this->isScope()) {
     DIScope(DbgNode).printInternal(OS);
   }
@@ -1106,6 +1108,14 @@ void DICompositeType::printInternal(raw_
   OS << " [" << A.getNumElements() << " elements]";
 }
 
+void DINameSpace::printInternal(raw_ostream &OS) const {
+  StringRef Name = getName();
+  if (!Name.empty())
+    OS << " [" << Name << ']';
+
+  OS << " [line " << getLineNumber() << ']';
+}
+
 void DISubprogram::printInternal(raw_ostream &OS) const {
   // TODO : Print context
   OS << " [line " << getLineNumber() << ']';





More information about the llvm-commits mailing list