summaryrefslogtreecommitdiff
path: root/lib/Target/TargetData.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-25 02:50:45 +0000
committerChris Lattner <sabre@nondot.org>2003-04-25 02:50:45 +0000
commit46326d9cdfa70c9ccbc58ca4ec67cc1d083530bc (patch)
tree8b3acd90e9e18ee1aee0f013fe09c93879185480 /lib/Target/TargetData.cpp
parentd6cbe339afebd5c16afec9b810ce46ffd3102791 (diff)
downloadllvm-46326d9cdfa70c9ccbc58ca4ec67cc1d083530bc.tar.gz
llvm-46326d9cdfa70c9ccbc58ca4ec67cc1d083530bc.tar.bz2
llvm-46326d9cdfa70c9ccbc58ca4ec67cc1d083530bc.tar.xz
Allow for easy detection of when a "default" TargetData is created by the
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
Diffstat (limited to 'lib/Target/TargetData.cpp')
-rw-r--r--lib/Target/TargetData.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 701b36640e..a0a3b82d24 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -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;