Thanks, all the major things should be accurate.<div><br></div><div>Just a minor thing:</div><div> - I didn't create a BuildXXX function, and followed the existing style of the other SEH nodes by creating the node in ActOnXXX.</div>

<div><br></div><div>If that is an issue I can fix it. And of course point 5., it's still missing code-gen support, but I will handle that separately for all __try contructs.</div><div><br><div><br><div class="gmail_quote">

On Sun, Sep 2, 2012 at 5:32 AM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Since you just implemented a new Stmt, could you take a look at<br>
<<a href="http://clang.llvm.org/docs/InternalsManual.html#AddingExprStmt" target="_blank">http://clang.llvm.org/docs/InternalsManual.html#AddingExprStmt</a>> and<br>
make sure that it is accurate?<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">--Sean Silva<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Sat, Sep 1, 2012 at 11:45 PM, Joao Matos <<a href="mailto:ripzonetriton@gmail.com">ripzonetriton@gmail.com</a>> wrote:<br>
> Author: triton<br>
> Date: Sat Sep  1 22:45:41 2012<br>
> New Revision: 163083<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=163083&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=163083&view=rev</a><br>
> Log:<br>
> Implemented parsing and AST support for the MS __leave exception statement. Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review.<br>
><br>
> Modified:<br>
>     cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
>     cfe/trunk/include/clang/AST/Stmt.h<br>
>     cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br>
>     cfe/trunk/include/clang/Basic/StmtNodes.td<br>
>     cfe/trunk/include/clang/Sema/Scope.h<br>
>     cfe/trunk/include/clang/Sema/Sema.h<br>
>     cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>
>     cfe/trunk/lib/AST/Stmt.cpp<br>
>     cfe/trunk/lib/AST/StmtPrinter.cpp<br>
>     cfe/trunk/lib/AST/StmtProfile.cpp<br>
>     cfe/trunk/lib/CodeGen/CGStmt.cpp<br>
>     cfe/trunk/lib/Parse/ParseStmt.cpp<br>
>     cfe/trunk/lib/Sema/SemaStmt.cpp<br>
>     cfe/trunk/lib/Sema/TreeTransform.h<br>
>     cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>
>     cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br>
>     cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp<br>
>     cfe/trunk/test/Parser/MicrosoftExtensions.c<br>
>     cfe/trunk/tools/libclang/RecursiveASTVisitor.h<br>
><br>
> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)<br>
> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Sat Sep  1 22:45:41 2012<br>
> @@ -2202,6 +2202,7 @@<br>
>  })<br>
><br>
>  DEF_TRAVERSE_STMT(SEHTryStmt, {})<br>
> +DEF_TRAVERSE_STMT(SEHLeaveStmt, {})<br>
>  DEF_TRAVERSE_STMT(SEHExceptStmt, {})<br>
>  DEF_TRAVERSE_STMT(SEHFinallyStmt,{})<br>
><br>
><br>
> Modified: cfe/trunk/include/clang/AST/Stmt.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/AST/Stmt.h (original)<br>
> +++ cfe/trunk/include/clang/AST/Stmt.h Sat Sep  1 22:45:41 2012<br>
> @@ -1889,6 +1889,34 @@<br>
>    static bool classof(SEHTryStmt *) { return true; }<br>
>  };<br>
><br>
> +class SEHLeaveStmt : public Stmt {<br>
> +  SourceLocation  LeaveLoc;<br>
> +<br>
> +  SEHLeaveStmt(SourceLocation LeaveLoc);<br>
> +<br>
> +  friend class ASTReader;<br>
> +  friend class ASTStmtReader;<br>
> +  explicit SEHLeaveStmt(EmptyShell E) : Stmt(SEHLeaveStmtClass, E) { }<br>
> +<br>
> +public:<br>
> +  static SEHLeaveStmt* Create(ASTContext &C,<br>
> +                              SourceLocation LeaveLoc);<br>
> +<br>
> +  SourceRange getSourceRange() const LLVM_READONLY {<br>
> +    return SourceRange(getLeaveLoc());<br>
> +  }<br>
> +<br>
> +  SourceLocation getLeaveLoc() const { return LeaveLoc; }<br>
> +<br>
> +  child_range children() { return child_range(); }<br>
> +<br>
> +  static bool classof(const Stmt *T) {<br>
> +    return T->getStmtClass() == SEHLeaveStmtClass;<br>
> +  }<br>
> +<br>
> +  static bool classof(SEHLeaveStmt *) { return true; }<br>
> +};<br>
> +<br>
>  }  // end namespace clang<br>
><br>
>  #endif<br>
><br>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)<br>
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Sat Sep  1 22:45:41 2012<br>
> @@ -740,6 +740,9 @@<br>
><br>
>  def err_seh___finally_block : Error<<br>
>    "%0 only allowed in __finally block">;<br>
> +<br>
> +def err_seh___try_block : Error<<br>
> +  "%0 only allowed in __try block">;<br>
><br>
>  } // end of Parse Issue category.<br>
><br>
><br>
> Modified: cfe/trunk/include/clang/Basic/StmtNodes.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/Basic/StmtNodes.td (original)<br>
> +++ cfe/trunk/include/clang/Basic/StmtNodes.td Sat Sep  1 22:45:41 2012<br>
> @@ -164,6 +164,7 @@<br>
>  // Microsoft Extensions.<br>
>  def CXXUuidofExpr : DStmt<Expr>;<br>
>  def SEHTryStmt : Stmt;<br>
> +def SEHLeaveStmt : Stmt;<br>
>  def SEHExceptStmt : Stmt;<br>
>  def SEHFinallyStmt : Stmt;<br>
>  def MSDependentExistsStmt : Stmt;<br>
><br>
> Modified: cfe/trunk/include/clang/Sema/Scope.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Scope.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Scope.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/Sema/Scope.h (original)<br>
> +++ cfe/trunk/include/clang/Sema/Scope.h Sat Sep  1 22:45:41 2012<br>
> @@ -82,7 +82,10 @@<br>
>      SwitchScope = 0x800,<br>
><br>
>      /// TryScope - This is the scope of a C++ try statement.<br>
> -    TryScope = 0x1000<br>
> +    TryScope = 0x1000,<br>
> +<br>
> +    /// SEHTryScope - This is scope of a Microsoft SEH try statement.<br>
> +    SEHTryScope = 0x2000<br>
>    };<br>
>  private:<br>
>    /// The parent scope for this scope.  This is null for the translation-unit<br>
> @@ -292,6 +295,9 @@<br>
>    /// \brief Determine whether this scope is a C++ 'try' block.<br>
>    bool isTryScope() const { return getFlags() & Scope::TryScope; }<br>
><br>
> +  /// \brief Determine whether this scope is a MS SEH 'try' block.<br>
> +  bool isSEHTryScope() const { return getFlags() & Scope::SEHTryScope; }<br>
> +<br>
>    /// containedInPrototypeScope - Return true if this or a parent scope<br>
>    /// is a FunctionPrototypeScope.<br>
>    bool containedInPrototypeScope() const;<br>
><br>
> Modified: cfe/trunk/include/clang/Sema/Sema.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/Sema/Sema.h (original)<br>
> +++ cfe/trunk/include/clang/Sema/Sema.h Sat Sep  1 22:45:41 2012<br>
> @@ -2622,6 +2622,8 @@<br>
>                                Stmt *TryBlock,<br>
>                                Stmt *Handler);<br>
><br>
> +  StmtResult ActOnSEHLeaveStmt(SourceLocation LeaveLoc);<br>
> +<br>
>    StmtResult ActOnSEHExceptBlock(SourceLocation Loc,<br>
>                                   Expr *FilterExpr,<br>
>                                   Stmt *Block);<br>
><br>
> Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)<br>
> +++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Sat Sep  1 22:45:41 2012<br>
> @@ -1204,6 +1204,7 @@<br>
>        STMT_SEH_EXCEPT,            // SEHExceptStmt<br>
>        STMT_SEH_FINALLY,           // SEHFinallyStmt<br>
>        STMT_SEH_TRY,               // SEHTryStmt<br>
> +      STMT_SEH_LEAVE,             // SEHLeaveStmt<br>
><br>
>        // ARC<br>
>        EXPR_OBJC_BRIDGED_CAST,     // ObjCBridgedCastExpr<br>
><br>
> Modified: cfe/trunk/lib/AST/Stmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/AST/Stmt.cpp (original)<br>
> +++ cfe/trunk/lib/AST/Stmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -1006,6 +1006,17 @@<br>
>    return dyn_cast<SEHFinallyStmt>(getHandler());<br>
>  }<br>
><br>
> +SEHLeaveStmt::SEHLeaveStmt(SourceLocation LeaveLoc)<br>
> +  : Stmt(SEHLeaveStmtClass),<br>
> +    LeaveLoc(LeaveLoc)<br>
> +{<br>
> +}<br>
> +<br>
> +SEHLeaveStmt* SEHLeaveStmt::Create(ASTContext &C,<br>
> +                                   SourceLocation LeaveLoc) {<br>
> +  return new(C) SEHLeaveStmt(LeaveLoc);<br>
> +}<br>
> +<br>
>  SEHExceptStmt::SEHExceptStmt(SourceLocation Loc,<br>
>                               Expr *FilterExpr,<br>
>                               Stmt *Block)<br>
><br>
> Modified: cfe/trunk/lib/AST/StmtPrinter.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/AST/StmtPrinter.cpp (original)<br>
> +++ cfe/trunk/lib/AST/StmtPrinter.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -537,6 +537,11 @@<br>
>    OS << "\n";<br>
>  }<br>
><br>
> +void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {<br>
> +  Indent() << "__leave;";<br>
> +  OS << "\n";<br>
> +}<br>
> +<br>
>  void StmtPrinter::PrintRawSEHFinallyStmt(SEHFinallyStmt *Node) {<br>
>    OS << "__finally ";<br>
>    PrintRawCompoundStmt(Node->getBlock());<br>
> @@ -546,7 +551,7 @@<br>
>  void StmtPrinter::PrintRawSEHExceptHandler(SEHExceptStmt *Node) {<br>
>    OS << "__except (";<br>
>    VisitExpr(Node->getFilterExpr());<br>
> -  OS << ")\n";<br>
> +  OS << ") ";<br>
>    PrintRawCompoundStmt(Node->getBlock());<br>
>    OS << "\n";<br>
>  }<br>
><br>
> Modified: cfe/trunk/lib/AST/StmtProfile.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/AST/StmtProfile.cpp (original)<br>
> +++ cfe/trunk/lib/AST/StmtProfile.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -215,6 +215,10 @@<br>
>    VisitStmt(S);<br>
>  }<br>
><br>
> +void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {<br>
> +  VisitStmt(S);<br>
> +}<br>
> +<br>
>  void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {<br>
>    VisitStmt(S);<br>
>  }<br>
><br>
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br>
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -163,6 +163,7 @@<br>
>    case Stmt::CXXForRangeStmtClass:<br>
>      EmitCXXForRangeStmt(cast<CXXForRangeStmt>(*S));<br>
>    case Stmt::SEHTryStmtClass:<br>
> +  case Stmt::SEHLeaveStmtClass:<br>
>      // FIXME Not yet implemented<br>
>      break;<br>
>    }<br>
><br>
> Modified: cfe/trunk/lib/Parse/ParseStmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Parse/ParseStmt.cpp (original)<br>
> +++ cfe/trunk/lib/Parse/ParseStmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -183,6 +183,19 @@<br>
><br>
>      return ParseExprStatement();<br>
>    }<br>
> +<br>
> +  case tok::kw___leave: {<br>
> +    Token LeaveTok = Tok;<br>
> +    ConsumeToken();<br>
> +    if (getCurScope()->isSEHTryScope()) {<br>
> +      Res = Actions.ActOnSEHLeaveStmt(LeaveTok.getLocation());<br>
> +    } else {<br>
> +      Diag(LeaveTok, diag::err_seh___try_block)<br>
> +         << LeaveTok.getIdentifierInfo()->getName();<br>
> +      Res = StmtError();<br>
> +    }<br>
> +    break;<br>
> +  }<br>
><br>
>    case tok::kw_case:                // C99 6.8.1: labeled-statement<br>
>      return ParseCaseStatement();<br>
> @@ -322,7 +335,9 @@<br>
>    if(Tok.isNot(tok::l_brace))<br>
>      return StmtError(Diag(Tok,diag::err_expected_lbrace));<br>
><br>
> -  StmtResult TryBlock(ParseCompoundStatement());<br>
> +  // Use the SEHTryScope to handle __leave as a statement.<br>
> +  unsigned ScopeFlags = Scope::DeclScope | Scope::SEHTryScope;<br>
> +  StmtResult TryBlock(ParseCompoundStatement(false /*isStmtExpr*/, ScopeFlags));<br>
>    if(TryBlock.isInvalid())<br>
>      return TryBlock;<br>
><br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaStmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaStmt.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaStmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -2746,6 +2746,12 @@<br>
>  }<br>
><br>
>  StmtResult<br>
> +Sema::ActOnSEHLeaveStmt(SourceLocation LeaveLoc)<br>
> +{<br>
> +  return Owned(SEHLeaveStmt::Create(Context, LeaveLoc));<br>
> +}<br>
> +<br>
> +StmtResult<br>
>  Sema::ActOnSEHExceptBlock(SourceLocation Loc,<br>
>                            Expr *FilterExpr,<br>
>                            Stmt *Block) {<br>
><br>
> Modified: cfe/trunk/lib/Sema/TreeTransform.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/TreeTransform.h (original)<br>
> +++ cfe/trunk/lib/Sema/TreeTransform.h Sat Sep  1 22:45:41 2012<br>
> @@ -1361,6 +1361,10 @@<br>
>      return getSema().ActOnSEHTryBlock(IsCXXTry,TryLoc,TryBlock,Handler);<br>
>    }<br>
><br>
> +  StmtResult RebuildSEHLeaveStmt(SourceLocation LeaveLoc) {<br>
> +    return getSema().ActOnSEHLeaveStmt(LeaveLoc);<br>
> +  }<br>
> +<br>
>    StmtResult RebuildSEHExceptStmt(SourceLocation Loc,<br>
>                                    Expr *FilterExpr,<br>
>                                    Stmt *Block) {<br>
> @@ -6001,6 +6005,12 @@<br>
><br>
>  template<typename Derived><br>
>  StmtResult<br>
> +TreeTransform<Derived>::TransformSEHLeaveStmt(SEHLeaveStmt *S) {<br>
> +  return getDerived().RebuildSEHLeaveStmt(S->getLeaveLoc());<br>
> +}<br>
> +<br>
> +template<typename Derived><br>
> +StmtResult<br>
>  TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {<br>
>    StmtResult Block; //  = getDerived().TransformCompoundStatement(S->getBlock());<br>
>    if(Block.isInvalid()) return StmtError();<br>
><br>
> Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)<br>
> +++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -1516,6 +1516,11 @@<br>
>    S->Children[SEHTryStmt::HANDLER] = Reader.ReadSubStmt();<br>
>  }<br>
><br>
> +void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {<br>
> +  VisitStmt(S);<br>
> +  S->LeaveLoc = ReadSourceLocation(Record, Idx);<br>
> +}<br>
> +<br>
>  //===----------------------------------------------------------------------===//<br>
>  // CUDA Expressions and Statements<br>
>  //===----------------------------------------------------------------------===//<br>
> @@ -1986,6 +1991,9 @@<br>
>      case STMT_SEH_TRY:<br>
>        S = new (Context) SEHTryStmt(Empty);<br>
>        break;<br>
> +    case STMT_SEH_LEAVE:<br>
> +      S = new (Context) SEHLeaveStmt(Empty);<br>
> +      break;<br>
>      case STMT_CXX_CATCH:<br>
>        S = new (Context) CXXCatchStmt(Empty);<br>
>        break;<br>
><br>
> Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)<br>
> +++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -1554,6 +1554,12 @@<br>
>    Code = serialization::STMT_SEH_TRY;<br>
>  }<br>
><br>
> +void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {<br>
> +  VisitStmt(S);<br>
> +  Writer.AddSourceLocation(S->getLeaveLoc(), Record);<br>
> +  Code = serialization::STMT_SEH_LEAVE;<br>
> +}<br>
> +<br>
>  //===----------------------------------------------------------------------===//<br>
>  // ASTWriter Implementation<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)<br>
> +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Sat Sep  1 22:45:41 2012<br>
> @@ -527,6 +527,7 @@<br>
>      case Stmt::PackExpansionExprClass:<br>
>      case Stmt::SubstNonTypeTemplateParmPackExprClass:<br>
>      case Stmt::SEHTryStmtClass:<br>
> +    case Stmt::SEHLeaveStmtClass:<br>
>      case Stmt::SEHExceptStmtClass:<br>
>      case Stmt::LambdaExprClass:<br>
>      case Stmt::SEHFinallyStmtClass: {<br>
><br>
> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)<br>
> +++ cfe/trunk/test/Parser/MicrosoftExtensions.c Sat Sep  1 22:45:41 2012<br>
> @@ -102,3 +102,9 @@<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 { } __except (0) { __leave; } // expected-error {{__leave only allowed in __try block}}<br>
> +  __try { } __finally { __leave; } // expected-error {{__leave only allowed in __try block}}<br>
> +}<br>
> \ No newline at end of file<br>
><br>
> Modified: cfe/trunk/tools/libclang/RecursiveASTVisitor.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/RecursiveASTVisitor.h?rev=163083&r1=163082&r2=163083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/RecursiveASTVisitor.h?rev=163083&r1=163082&r2=163083&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/tools/libclang/RecursiveASTVisitor.h (original)<br>
> +++ cfe/trunk/tools/libclang/RecursiveASTVisitor.h Sat Sep  1 22:45:41 2012<br>
> @@ -2122,6 +2122,7 @@<br>
>  })<br>
><br>
>  DEF_TRAVERSE_STMT(SEHTryStmt, {})<br>
> +DEF_TRAVERSE_STMT(SEHLeaveStmt, {})<br>
>  DEF_TRAVERSE_STMT(SEHExceptStmt, {})<br>
>  DEF_TRAVERSE_STMT(SEHFinallyStmt,{})<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>João Matos<br>
</div></div>