forked from OSchip/llvm-project
For PR1289:
Check at the end of the parse that there are no unresolved types and no undefined values. Issue errors if there are. This gets rid of the need for implementation or checkpoint by ensuring you can't finish a parse with undefined things. llvm-svn: 35499
This commit is contained in:
parent
3c401f0613
commit
cf2ccbff1a
|
@ -2950,6 +2950,38 @@ static Module* RunParser(Module * M) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Emit an error if there are any unresolved types left.
|
||||
if (!CurModule.LateResolveTypes.empty()) {
|
||||
const ValID &DID = CurModule.LateResolveTypes.begin()->first;
|
||||
if (DID.Type == ValID::LocalName) {
|
||||
GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
|
||||
} else {
|
||||
GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
|
||||
}
|
||||
if (ParserResult)
|
||||
delete ParserResult;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Emit an error if there are any unresolved values left.
|
||||
if (!CurModule.LateResolveValues.empty()) {
|
||||
Value *V = CurModule.LateResolveValues.back();
|
||||
std::map<Value*, std::pair<ValID, int> >::iterator I =
|
||||
CurModule.PlaceHolderInfo.find(V);
|
||||
|
||||
if (I != CurModule.PlaceHolderInfo.end()) {
|
||||
ValID &DID = I->second.first;
|
||||
if (DID.Type == ValID::LocalName) {
|
||||
GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
|
||||
} else {
|
||||
GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
|
||||
}
|
||||
if (ParserResult)
|
||||
delete ParserResult;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to make sure that parsing produced a result
|
||||
if (!ParserResult)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue