On Fri, May 27, 2016 at 12:19 PM, don hinton <hinto...@gmail.com> wrote:
> hintonda added inline comments.
>
> ================
> Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428
> @@ -3402,6 +3402,7 @@
>    // If we already had a dynamic specification, parse the noexcept for,
>    // recovery, but emit a diagnostic and don't store the results.
> -  SourceRange NoexceptRange;
> +  SourceRange NoexceptRange(Tok.getLocation(),
> +                            Tok.getEndLoc().getLocWithOffset(-1));
>    ExceptionSpecificationType NoexceptType = EST_None;
>
>    SourceLocation KeywordLoc = ConsumeToken();
>
> @@ -3424,6 +3425,5 @@
>    } else {
>      // There is no argument.
>      NoexceptType = EST_BasicNoexcept;
> -    NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
>    }
>
> ----------------
> The range for a single token is a single location.  The problem is your test. 
>  The range for "throw()" ends at the start of the ')' token.  For "noexcept", 
> the beginning and end are the same location, e.g., here's how "int" is tested:

That's right! I forgot that source ranges are not *char* source ranges
but token source ranges. Thank you for the reminder.

~Aaron

>
> ```
> TEST(MatchVerifier, ParseError) {
>   LocationVerifier<VarDecl> Verifier;
>   Verifier.expectLocation(1, 1);
>   EXPECT_FALSE(Verifier.match("int i", varDecl()));
> }
> ```
>
> I think you should use this instead:
>
> ```
> SourceRange NoexceptRange(Tok.getLocation());
> ```
>
>
> http://reviews.llvm.org/D20428
>
>
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to