[PATCH] D34185: [Parser][ObjC] Avoid crashing when skipping to EOF while parsing an ObjC interface/implementation
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 14 13:12:50 PDT 2017
arphaman added a comment.
In https://reviews.llvm.org/D34185#780494, @ahatanak wrote:
> This patch fixes the crash and that is fine, but the users might find the last error ("expected '}'" at the end of the file) confusing. This seems to happen because Parser::ParseLexedObjCMethodDefs consumes all tokens in the file until it sees the EOF after consuming all the cached tokens of LexedMethod.
>
> I wonder whether we can insert a fake EOF token to prevent ParseLexedObjCMethodDefs from going all the way to the end, just like ParseCXXNonStaticMemberInitialize does. Do you think that would work or would it be too hackish?
I think that it would probably work quite well. I've thought about fixing it while working on a patch as well, but didn't realize that we could just inject EOF into the token stream. I will update this patch with this kind of handling then.
Repository:
rL LLVM
https://reviews.llvm.org/D34185
More information about the cfe-commits
mailing list