Provide more information in the error message that occurs when there are
authorReid Spencer <rspencer@reidspencer.com>
Sat, 4 Dec 2004 22:19:53 +0000 (22:19 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sat, 4 Dec 2004 22:19:53 +0000 (22:19 +0000)
unresolved constants remaining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18502 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/Reader.cpp

index a18019aca0aba03c00d03c9f1095b77dab891840..8f0a7f8a8dc8c1350e966db80775bb3d965b2467 100644 (file)
@@ -1571,8 +1571,16 @@ void BytecodeReader::ParseConstantPool(ValueTable &Tab,
 
   // After we have finished parsing the constant pool, we had better not have
   // any dangling references left.
-  if (!ConstantFwdRefs.empty())
-    error("Unresolved constant references exist!");
+  if (!ConstantFwdRefs.empty()) {
+  typedef std::map<std::pair<const Type*,unsigned>, Constant*> ConstantRefsType;
+    ConstantRefsType::const_iterator I = ConstantFwdRefs.begin();
+    const Type* missingType = I->first.first;
+    Constant* missingConst = I->second;
+    error(utostr(ConstantFwdRefs.size()) + 
+          " unresolved constant reference exist. First one is '" + 
+          missingConst->getName() + "' of type '" + 
+          missingType->getDescription() + "'.");
+  }
 
   checkPastBlockEnd("Constant Pool");
   if (Handler) Handler->handleGlobalConstantsEnd();