summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2014-07-31 01:43:57 +0000
committerPete Cooper <peter_cooper@apple.com>2014-07-31 01:43:57 +0000
commit040c6a6708a63ab1473919d6224cf6f1c8180815 (patch)
treec8b4899431be23580b07d2cf0f3c05e0611c7c04 /llvm/lib
parent8a00302ba46e8b9ddbcbb04945b96fb151d43d7a (diff)
downloadbcm5719-llvm-040c6a6708a63ab1473919d6224cf6f1c8180815.tar.gz
bcm5719-llvm-040c6a6708a63ab1473919d6224cf6f1c8180815.zip
Add a better error message when failing to assign one tablegen value to another
This is currently for assigning from one bit init to another. It can easily be extended to other types. Test to follow soon in another patch. llvm-svn: 214374
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/TableGen/TGParser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 0550692ebce..54932487e8d 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -135,11 +135,18 @@ bool TGParser::SetValue(Record *CurRec, SMLoc Loc, Init *ValName,
V = BitsInit::get(NewBits);
}
- if (RV->setValue(V))
+ if (RV->setValue(V)) {
+ std::string InitType = "";
+ if (BitsInit *BI = dyn_cast<BitsInit>(V)) {
+ InitType = (Twine("' of type bit initializer with length ") +
+ Twine(BI->getNumBits())).str();
+ }
return Error(Loc, "Value '" + ValName->getAsUnquotedString() + "' of type '"
+ RV->getType()->getAsString() +
"' is incompatible with initializer '" + V->getAsString()
+ + InitType
+ "'");
+ }
return false;
}
OpenPOWER on IntegriCloud