Remove DIGlobal.
authorDevang Patel <dpatel@apple.com>
Fri, 7 May 2010 23:19:07 +0000 (23:19 +0000)
committerDevang Patel <dpatel@apple.com>
Fri, 7 May 2010 23:19:07 +0000 (23:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103325 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index af4b5f7f144f447ebbdbfe4e2809ae86cb114787..444c706690c49f9f55ca572dc5e8627ffb81b67a 100644 (file)
@@ -335,41 +335,6 @@ namespace llvm {
     void dump() const;
   };
 
-  /// DIGlobal - This is a common class for global variables and subprograms.
-  class DIGlobal : public DIDescriptor {
-  protected:
-    explicit DIGlobal(const MDNode *N) : DIDescriptor(N) {}
-
-  public:
-    virtual ~DIGlobal() {}
-
-    DIScope getContext() const          { return getFieldAs<DIScope>(2); }
-    StringRef getName() const         { return getStringField(3); }
-    StringRef getDisplayName() const  { return getStringField(4); }
-    StringRef getLinkageName() const  { return getStringField(5); }
-    DICompileUnit getCompileUnit() const{ 
-      if (getVersion() == llvm::LLVMDebugVersion7)
-        return getFieldAs<DICompileUnit>(6);
-
-      DIFile F = getFieldAs<DIFile>(6); 
-      return F.getCompileUnit();
-    }
-
-    unsigned getLineNumber() const      { return getUnsignedField(7); }
-    DIType getType() const              { return getFieldAs<DIType>(8); }
-
-    /// isLocalToUnit - Return true if this subprogram is local to the current
-    /// compile unit, like 'static' in C.
-    unsigned isLocalToUnit() const      { return getUnsignedField(9); }
-    unsigned isDefinition() const       { return getUnsignedField(10); }
-
-    /// print - print global.
-    void print(raw_ostream &OS) const;
-
-    /// dump - print global to dbgs() with a newline.
-    void dump() const;
-  };
-
   /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
   class DISubprogram : public DIScope {
   public:
@@ -447,9 +412,26 @@ namespace llvm {
   };
 
   /// DIGlobalVariable - This is a wrapper for a global variable.
-  class DIGlobalVariable : public DIGlobal {
+  class DIGlobalVariable : public DIDescriptor {
   public:
-    explicit DIGlobalVariable(const MDNode *N = 0) : DIGlobal(N) {}
+    explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
+
+    DIScope getContext() const          { return getFieldAs<DIScope>(2); }
+    StringRef getName() const         { return getStringField(3); }
+    StringRef getDisplayName() const  { return getStringField(4); }
+    StringRef getLinkageName() const  { return getStringField(5); }
+    DICompileUnit getCompileUnit() const{ 
+      if (getVersion() == llvm::LLVMDebugVersion7)
+        return getFieldAs<DICompileUnit>(6);
+
+      DIFile F = getFieldAs<DIFile>(6); 
+      return F.getCompileUnit();
+    }
+
+    unsigned getLineNumber() const      { return getUnsignedField(7); }
+    DIType getType() const              { return getFieldAs<DIType>(8); }
+    unsigned isLocalToUnit() const      { return getUnsignedField(9); }
+    unsigned isDefinition() const       { return getUnsignedField(10); }
 
     GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
 
index 7bbae59b87a81e07b2e1e4bcc32a7d9b820f4b44..717c7fb5143029eb699ea643443bf0ff6701091e 100644 (file)
@@ -527,8 +527,8 @@ void DICompositeType::print(raw_ostream &OS) const {
   OS << " [" << A.getNumElements() << " elements]";
 }
 
-/// print - Print global.
-void DIGlobal::print(raw_ostream &OS) const {
+/// print - Print subprogram.
+void DISubprogram::print(raw_ostream &OS) const {
   StringRef Res = getName();
   if (!Res.empty())
     OS << " [" << Res << "] ";
@@ -546,14 +546,12 @@ void DIGlobal::print(raw_ostream &OS) const {
   if (isDefinition())
     OS << " [def] ";
 
-  if (isGlobalVariable())
-    DIGlobalVariable(DbgNode).print(OS);
-
   OS << "\n";
 }
 
-/// print - Print subprogram.
-void DISubprogram::print(raw_ostream &OS) const {
+/// print - Print global variable.
+void DIGlobalVariable::print(raw_ostream &OS) const {
+  OS << " [";
   StringRef Res = getName();
   if (!Res.empty())
     OS << " [" << Res << "] ";
@@ -571,14 +569,9 @@ void DISubprogram::print(raw_ostream &OS) const {
   if (isDefinition())
     OS << " [def] ";
 
-  OS << "\n";
-}
-
-/// print - Print global variable.
-void DIGlobalVariable::print(raw_ostream &OS) const {
-  OS << " [";
-  getGlobal()->print(OS);
-  OS << "] ";
+  if (isGlobalVariable())
+    DIGlobalVariable(DbgNode).print(OS);
+  OS << "]\n";
 }
 
 /// print - Print variable.
@@ -625,11 +618,6 @@ void DICompositeType::dump() const {
   print(dbgs()); dbgs() << '\n';
 }
 
-/// dump - Print global to dbgs() with a newline.
-void DIGlobal::dump() const {
-  print(dbgs()); dbgs() << '\n';
-}
-
 /// dump - Print subprogram to dbgs() with a newline.
 void DISubprogram::dump() const {
   print(dbgs()); dbgs() << '\n';
index 9e5472b2f91ef7256972645641e3957d65ab27ec..e319c28932547e6d131d7905fc4f58aac8e83c23 100644 (file)
@@ -462,7 +462,7 @@ void DwarfDebug::addSourceLine(DIE *Die, const DIVariable *V) {
 
 /// addSourceLine - Add location information to specified debug information
 /// entry.
-void DwarfDebug::addSourceLine(DIE *Die, const DIGlobal *G) {
+void DwarfDebug::addSourceLine(DIE *Die, const DIGlobalVariable *G) {
   // If there is no compile unit specified, don't add a line #.
   if (!G->getCompileUnit().Verify())
     return;
index 5915c6f66c3f8f36f8e7c6eb8f89e019ce0f18ed..f3d64070f9718547a5ba6b7b3f96dd2701b60da4 100644 (file)
@@ -295,7 +295,7 @@ private:
   /// addSourceLine - Add location information to specified debug information
   /// entry.
   void addSourceLine(DIE *Die, const DIVariable *V);
-  void addSourceLine(DIE *Die, const DIGlobal *G);
+  void addSourceLine(DIE *Die, const DIGlobalVariable *G);
   void addSourceLine(DIE *Die, const DISubprogram *SP);
   void addSourceLine(DIE *Die, const DIType *Ty);
   void addSourceLine(DIE *Die, const DINameSpace *NS);