Yeah, there's a bug I found shortly after posting the patch. It was't consuming the ";" after the keyword, so a NullStmt was created. I fixed this locally and the other issue you pointed out.<div><br></div>

<div>I'll send the updated patch later.<div><div><br><br><div class="gmail_quote">On Thu, Aug 30, 2012 at 5:19 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Aug 28, 2012 at 6:59 PM, Joćo Matos <<a href="mailto:ripzonetriton@gmail.com">ripzonetriton@gmail.com</a>> wrote:<br>


> Hi, attached patch adds support for the "__leave" keyword used in "__try"<br>
> exception handling support on Windows/MSVC.<br>
<br>
</div>Thanks for tackling this!<br>
<br>
> diff --git a/include/clang/AST/RecursiveASTVisitor.h<br>
> b/include/clang/AST/RecursiveASTVisitor.h<br>
> index c24b0a9..7fdecdc 100644<br>
<br>
Please submit svn patches instead of git patches.  It may seem minor,<br>
but not all diff clients handle git particularly well (esp on Windows<br>
where TortoiseSVN is used frequently).<br>
<br>
> diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp<br>
> index f58f90d..6597cf8 100644<br>
> --- a/lib/Parse/ParseStmt.cpp<br>
> +++ b/lib/Parse/ParseStmt.cpp<br>
> @@ -169,6 +169,20 @@ Retry:<br>
>    }<br>
><br>
>    default: {<br>
> +<br>
> +    if (Kind == tok::kw___leave) {<br>
> +      Token LeaveTok = Tok;<br>
> +      ConsumeToken();<br>
> +<br>
> +      if (!getCurScope()->isSEHTryScope()) {<br>
> +        Diag(Tok, diag::err_seh___try_block)<br>
> +            << LeaveTok.getIdentifierInfo()->getName();<br>
> +        return StmtError();<br>
> +      }<br>
<br>
Is this putting the diagnostic on the correct token -- it seems like<br>
it should be against the __leave instead of the token after it.<br>
<br>
> diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c<br>
> index 7703999..676b599 100644<br>
> --- a/test/Parser/MicrosoftExtensions.c<br>
> +++ b/test/Parser/MicrosoftExtensions.c<br>
> @@ -102,3 +102,8 @@ __declspec() void quux( void ) {<br>
>    struct S7 s;<br>
>    int i = s.t;       /* expected-warning {{'t' is deprecated}} */<br>
>  }<br>
> +<br>
> +void SEH() {<br>
> +  __try { __leave; } __except (0) {}<br>
> +  __try { } __finally { __leave; } // expected-error {{__leave only allowed in __try block}}<br>
> +}<br>
> \ No newline at end of file<br>
<br>
Should have a newline at the end of this file.  Also, can you add a<br>
test for __leave in an __except block?<br>
<br>
Aside from this, it looks reasonable to me at first blush.<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Joćo Matos<br>
</div></div></div>