Allow for easy detection of when a "default" TargetData is created by the
passmanager, which is never the right thing to do.

llvm-svn: 5922
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp
index 701b366..a0a3b82 100644
--- a/llvm/lib/Target/TargetData.cpp
+++ b/llvm/lib/Target/TargetData.cpp
@@ -91,6 +91,13 @@
   : AID(AnnotationManager::getID("TargetData::" + TargetName)) {
   AnnotationManager::registerAnnotationFactory(AID, TypeAnFactory, this);
 
+  // If this assert triggers, a pass "required" TargetData information, but the
+  // top level tool did not provide once for it.  We do not want to default
+  // construct, or else we might end up using a bad endianness or pointer size!
+  //
+  assert(!TargetName.empty() &&
+         "ERROR: Tool did not specify a target data to use!");
+
   LittleEndian     = isLittleEndian;
   SubWordDataSize  = SubWordSize;
   IntegerRegSize   = IntRegSize;