Allow for easy detection of when a "default" TargetData is created by the
authorChris Lattner <sabre@nondot.org>
Fri, 25 Apr 2003 02:50:45 +0000 (02:50 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 25 Apr 2003 02:50:45 +0000 (02:50 +0000)
passmanager, which is never the right thing to do.

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

lib/Target/TargetData.cpp

index 701b36640ec764423de608c80e6eaace5e5dd7f5..a0a3b82d24fa9cf48fd4c0c3645b4f154d9557e5 100644 (file)
@@ -91,6 +91,13 @@ TargetData::TargetData(const std::string &TargetName,
   : 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;