[cfe-commits] [patch] [Windows] __leave keyword parsing and AST nodes
João Matos
ripzonetriton at gmail.com
Thu Aug 30 09:40:04 PDT 2012
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.
I'll send the updated patch later.
On Thu, Aug 30, 2012 at 5:19 PM, Aaron Ballman <aaron at aaronballman.com>wrote:
> On Tue, Aug 28, 2012 at 6:59 PM, João Matos <ripzonetriton at gmail.com>
> wrote:
> > Hi, attached patch adds support for the "__leave" keyword used in "__try"
> > exception handling support on Windows/MSVC.
>
> Thanks for tackling this!
>
> > diff --git a/include/clang/AST/RecursiveASTVisitor.h
> > b/include/clang/AST/RecursiveASTVisitor.h
> > index c24b0a9..7fdecdc 100644
>
> Please submit svn patches instead of git patches. It may seem minor,
> but not all diff clients handle git particularly well (esp on Windows
> where TortoiseSVN is used frequently).
>
> > diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
> > index f58f90d..6597cf8 100644
> > --- a/lib/Parse/ParseStmt.cpp
> > +++ b/lib/Parse/ParseStmt.cpp
> > @@ -169,6 +169,20 @@ Retry:
> > }
> >
> > default: {
> > +
> > + if (Kind == tok::kw___leave) {
> > + Token LeaveTok = Tok;
> > + ConsumeToken();
> > +
> > + if (!getCurScope()->isSEHTryScope()) {
> > + Diag(Tok, diag::err_seh___try_block)
> > + << LeaveTok.getIdentifierInfo()->getName();
> > + return StmtError();
> > + }
>
> Is this putting the diagnostic on the correct token -- it seems like
> it should be against the __leave instead of the token after it.
>
> > diff --git a/test/Parser/MicrosoftExtensions.c
> b/test/Parser/MicrosoftExtensions.c
> > index 7703999..676b599 100644
> > --- a/test/Parser/MicrosoftExtensions.c
> > +++ b/test/Parser/MicrosoftExtensions.c
> > @@ -102,3 +102,8 @@ __declspec() void quux( void ) {
> > struct S7 s;
> > int i = s.t; /* expected-warning {{'t' is deprecated}} */
> > }
> > +
> > +void SEH() {
> > + __try { __leave; } __except (0) {}
> > + __try { } __finally { __leave; } // expected-error {{__leave only
> allowed in __try block}}
> > +}
> > \ No newline at end of file
>
> Should have a newline at the end of this file. Also, can you add a
> test for __leave in an __except block?
>
> Aside from this, it looks reasonable to me at first blush.
>
> ~Aaron
>
--
João Matos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120830/2e44e6fb/attachment.html>
More information about the cfe-commits
mailing list