Emit a more sensible error message if no subclasses of Target are defined.

Patch contributed by Vladimir Prus.

llvm-svn: 14010
This commit is contained in:
Misha Brukman 2004-06-04 14:59:42 +00:00
parent 57c586cf78
commit aff10d0461
1 changed files with 2 additions and 0 deletions

View File

@ -72,6 +72,8 @@ std::ostream &operator<<(std::ostream &OS, MVT::ValueType T) {
///
CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) {
std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target");
if (Targets.size() == 0)
throw std::string("ERROR: No 'Target' subclasses defined!");
if (Targets.size() != 1)
throw std::string("ERROR: Multiple subclasses of Target defined!");
TargetRec = Targets[0];