Fix a warning in release builds and a test case I forgot to update with
[oota-llvm.git] / lib / VMCore / DebugInfo.cpp
index bb700a94817b399fe9cde00ba15c4e021e514bec..c8f8f7d67b845678eac7969d423acde39d1e96ef 100644 (file)
@@ -998,8 +998,6 @@ void DIDescriptor::print(raw_ostream &OS) const {
 
   if (this->isSubrange()) {
     DISubrange(DbgNode).printInternal(OS);
-  } else if (this->isScope()) {
-    DIScope(DbgNode).printInternal(OS);
   } else if (this->isCompileUnit()) {
     DICompileUnit(DbgNode).printInternal(OS);
   } else if (this->isFile()) {
@@ -1020,6 +1018,8 @@ void DIDescriptor::print(raw_ostream &OS) const {
     DIVariable(DbgNode).printInternal(OS);
   } else if (this->isObjCProperty()) {
     DIObjCProperty(DbgNode).printInternal(OS);
+  } else if (this->isScope()) {
+    DIScope(DbgNode).printInternal(OS);
   }
 }
 
@@ -1081,12 +1081,7 @@ void DICompositeType::printInternal(raw_ostream &OS) const {
 }
 
 void DISubprogram::printInternal(raw_ostream &OS) const {
-  StringRef Res = getName();
-  if (!Res.empty())
-    OS << " [" << Res << ']';
-
   // TODO : Print context
-
   OS << " [line " << getLineNumber() << ']';
 
   if (isLocalToUnit())
@@ -1097,6 +1092,10 @@ void DISubprogram::printInternal(raw_ostream &OS) const {
 
   if (getScopeLineNumber() != getLineNumber())
     OS << " [scope " << getScopeLineNumber() << "]";
+
+  StringRef Res = getName();
+  if (!Res.empty())
+    OS << " [" << Res << ']';
 }
 
 void DIGlobalVariable::printInternal(raw_ostream &OS) const {