mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a5ad78e746
commit
cd5bd90a7b
@ -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
Block a user