[Driver] Check type of InputElement before request a error message. If the

element is a FileNode, request error description. If the element is Group,
print hard coded error message. We need to implement a better diagnostics
here but even current solution is better than a segmentation fault output.

llvm-svn: 207691
This commit is contained in:
Simon Atanasyan 2014-04-30 19:04:01 +00:00
parent db8a4a8578
commit a64f34b759
1 changed files with 7 additions and 2 deletions

View File

@ -63,8 +63,13 @@ bool Driver::link(LinkingContext &context, raw_ostream &diagnostics) {
llvm::raw_string_ostream stream(buf);
if (error_code ec = ie->parse(context, stream)) {
FileNode *fileNode = dyn_cast<FileNode>(ie.get());
stream << fileNode->errStr(ec) << "\n";
if (FileNode *fileNode = dyn_cast<FileNode>(ie.get()))
stream << fileNode->errStr(ec) << "\n";
else if (dyn_cast<Group>(ie.get()))
// FIXME: We need a better diagnostics here
stream << "Cannot parse group input element\n";
else
llvm_unreachable("Unknown type of input element");
fail = true;
}