[PATCH] Parse: Don't crash on trailing whitespace before EOF
Nico Weber
thakis at chromium.org
Wed Jul 23 12:55:21 PDT 2014
Test?
On Wed, Jul 23, 2014 at 12:48 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
> Hi rsmith,
>
> Parser::ParseDeclarationSpecifiers eagerly updates the source range of
> the DeclSpec with the current token position. However, it might not
> consume any more tokens.
>
> Fix this by only setting the start of the range, not the end. This way
> the SourceRange will be invalid if we don't consume any more tokens.
>
> This fixes PR20413.
>
> http://reviews.llvm.org/D4646
>
> Files:
> lib/Parse/ParseDecl.cpp
>
> Index: lib/Parse/ParseDecl.cpp
> ===================================================================
> --- lib/Parse/ParseDecl.cpp
> +++ lib/Parse/ParseDecl.cpp
> @@ -2450,7 +2450,7 @@
> LateParsedAttrList *LateAttrs) {
> if (DS.getSourceRange().isInvalid()) {
> DS.SetRangeStart(Tok.getLocation());
> - DS.SetRangeEnd(Tok.getLocation());
> + DS.SetRangeEnd(SourceLocation());
> }
>
> bool EnteringContext = (DSContext == DSC_class || DSContext ==
> DSC_top_level);
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140723/cb9200c4/attachment.html>
More information about the cfe-commits
mailing list