[PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 20:28:04 PST 2016


majnemer added a subscriber: majnemer.
majnemer added a comment.

I believe this change is correct but I believe we can handle this a little more efficiently.

I wonder if it would be better if we instead inserted a special EOF token at the end of `Toks`.  If any errors occur, consume tokens until we hit our special EOF token. `ParseLexedAttribute` and `ParseLexedMethodDeclaration` follow this pattern.  To make it a little more obvious that the lifetime of `Toks` is somehow tied to `EnterTokenStream` and the parsing code that follows, it might make sense to factor the code after `EnterTokenStream` into another function.


http://reviews.llvm.org/D16572





More information about the cfe-commits mailing list