<div dir="ltr">I didn't modify AddStmtExprs() in ASTWriter.cpp, since none of the SEH nodes are in there (and e.g. STMT_CXX_TRY isn't either). Does anyone know what this function is good for, and if it should be updated with STMTs that are currently missing from there?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 6, 2014 at 5:12 PM, Nico Weber <span dir="ltr"><<a href="mailto:nicolasweber@gmx.de" target="_blank">nicolasweber@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: nico<br>
Date: Sun Jul 6 19:12:30 2014<br>
New Revision: 212425<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212425&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212425&view=rev</a><br>
Log:<br>
Add an AST node for __leave statements, hook it up.<br>
<br>
Codegen is still missing (and I won't work on that), but __leave is now<br>
as implemented as __try and friends.<br>
<br>
Modified:<br>
cfe/trunk/include/clang-c/Index.h<br>
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h<br>
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
cfe/trunk/include/clang/AST/Stmt.h<br>
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
cfe/trunk/include/clang/Basic/StmtNodes.td<br>
cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>
cfe/trunk/lib/AST/StmtPrinter.cpp<br>
cfe/trunk/lib/AST/StmtProfile.cpp<br>
cfe/trunk/lib/CodeGen/CGException.cpp<br>
cfe/trunk/lib/CodeGen/CGStmt.cpp<br>
cfe/trunk/lib/CodeGen/CodeGenFunction.h<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/test/CodeGen/exceptions-seh.c<br>
cfe/trunk/test/Sema/__try.c<br>
cfe/trunk/tools/libclang/CIndex.cpp<br>
cfe/trunk/tools/libclang/CXCursor.cpp<br>
<br>
Modified: cfe/trunk/include/clang-c/Index.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang-c/Index.h (original)<br>
+++ cfe/trunk/include/clang-c/Index.h Sun Jul 6 19:12:30 2014<br>
@@ -2155,7 +2155,11 @@ enum CXCursorKind {<br>
*/<br>
CXCursor_OMPSingleDirective = 237,<br>
<br>
- CXCursor_LastStmt = CXCursor_OMPSingleDirective,<br>
+ /** \brief Windows Structured Exception Handling's leave statement.<br>
+ */<br>
+ CXCursor_SEHLeaveStmt = 238,<br>
+<br>
+ CXCursor_LastStmt = CXCursor_SEHLeaveStmt,<br>
<br>
/**<br>
* \brief Cursor that represents the translation unit itself.<br>
<br>
Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)<br>
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Sun Jul 6 19:12:30 2014<br>
@@ -2232,6 +2232,7 @@ DEF_TRAVERSE_STMT(UnresolvedMemberExpr,<br>
DEF_TRAVERSE_STMT(SEHTryStmt, {})<br>
DEF_TRAVERSE_STMT(SEHExceptStmt, {})<br>
DEF_TRAVERSE_STMT(SEHFinallyStmt, {})<br>
+DEF_TRAVERSE_STMT(SEHLeaveStmt, {})<br>
DEF_TRAVERSE_STMT(CapturedStmt, { TRY_TO(TraverseDecl(S->getCapturedDecl())); })<br>
<br>
DEF_TRAVERSE_STMT(CXXOperatorCallExpr, {})<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)<br>
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Sun Jul 6 19:12:30 2014<br>
@@ -2254,6 +2254,7 @@ DEF_TRAVERSE_STMT(UnresolvedMemberExpr,<br>
DEF_TRAVERSE_STMT(SEHTryStmt, {})<br>
DEF_TRAVERSE_STMT(SEHExceptStmt, {})<br>
DEF_TRAVERSE_STMT(SEHFinallyStmt, {})<br>
+DEF_TRAVERSE_STMT(SEHLeaveStmt, {})<br>
DEF_TRAVERSE_STMT(CapturedStmt, { TRY_TO(TraverseDecl(S->getCapturedDecl())); })<br>
<br>
DEF_TRAVERSE_STMT(CXXOperatorCallExpr, {})<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/Stmt.h (original)<br>
+++ cfe/trunk/include/clang/AST/Stmt.h Sun Jul 6 19:12:30 2014<br>
@@ -1936,6 +1936,31 @@ public:<br>
}<br>
};<br>
<br>
+/// Represents a __leave statement.<br>
+///<br>
+class SEHLeaveStmt : public Stmt {<br>
+ SourceLocation LeaveLoc;<br>
+public:<br>
+ explicit SEHLeaveStmt(SourceLocation LL)<br>
+ : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}<br>
+<br>
+ /// \brief Build an empty __leave statement.<br>
+ explicit SEHLeaveStmt(EmptyShell Empty) : Stmt(SEHLeaveStmtClass, Empty) { }<br>
+<br>
+ SourceLocation getLeaveLoc() const { return LeaveLoc; }<br>
+ void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }<br>
+<br>
+ SourceLocation getLocStart() const LLVM_READONLY { return LeaveLoc; }<br>
+ SourceLocation getLocEnd() const LLVM_READONLY { return LeaveLoc; }<br>
+<br>
+ static bool classof(const Stmt *T) {<br>
+ return T->getStmtClass() == SEHLeaveStmtClass;<br>
+ }<br>
+<br>
+ // Iterators<br>
+ child_range children() { return child_range(); }<br>
+};<br>
+<br>
/// \brief This captures a statement into a function. For example, the following<br>
/// pragma annotated compound statement can be represented as a CapturedStmt,<br>
/// and this compound statement is the body of an anonymous outlined function.<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Jul 6 19:12:30 2014<br>
@@ -5153,8 +5153,6 @@ def err_need_header_before_typeid : Erro<br>
"you need to include <typeinfo> before using the 'typeid' operator">;<br>
def err_need_header_before_ms_uuidof : Error<<br>
"you need to include <guiddef.h> before using the '__uuidof' operator">;<br>
-def err_ms___leave_unimplemented : Error<<br>
- "__leave support not implemented yet">;<br>
def err_ms___leave_not_in___try : Error<<br>
"'__leave' statement not in __try block">;<br>
def err_uuidof_without_guid : Error<<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/StmtNodes.td (original)<br>
+++ cfe/trunk/include/clang/Basic/StmtNodes.td Sun Jul 6 19:12:30 2014<br>
@@ -170,6 +170,7 @@ def CXXUuidofExpr : DStmt<Expr>;<br>
def SEHTryStmt : Stmt;<br>
def SEHExceptStmt : Stmt;<br>
def SEHFinallyStmt : Stmt;<br>
+def SEHLeaveStmt : Stmt;<br>
def MSDependentExistsStmt : Stmt;<br>
<br>
// OpenCL Extensions.<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)<br>
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Sun Jul 6 19:12:30 2014<br>
@@ -1334,6 +1334,7 @@ namespace clang {<br>
EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr<br>
EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).<br>
EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).<br>
+ STMT_SEH_LEAVE, // SEHLeaveStmt<br>
STMT_SEH_EXCEPT, // SEHExceptStmt<br>
STMT_SEH_FINALLY, // SEHFinallyStmt<br>
STMT_SEH_TRY, // SEHTryStmt<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)<br>
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Sun Jul 6 19:12:30 2014<br>
@@ -573,6 +573,11 @@ void StmtPrinter::VisitSEHFinallyStmt(SE<br>
OS << "\n";<br>
}<br>
<br>
+void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {<br>
+ Indent() << "__leave;";<br>
+ if (Policy.IncludeNewlines) OS << "\n";<br>
+}<br>
+<br>
//===----------------------------------------------------------------------===//<br>
// OpenMP clauses printing methods<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)<br>
+++ cfe/trunk/lib/AST/StmtProfile.cpp Sun Jul 6 19:12:30 2014<br>
@@ -214,6 +214,10 @@ void StmtProfiler::VisitSEHExceptStmt(co<br>
VisitStmt(S);<br>
}<br>
<br>
+void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {<br>
+ VisitStmt(S);<br>
+}<br>
+<br>
void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {<br>
VisitStmt(S);<br>
}<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGException.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGException.cpp Sun Jul 6 19:12:30 2014<br>
@@ -1632,3 +1632,7 @@ llvm::BasicBlock *CodeGenFunction::getEH<br>
void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) {<br>
CGM.ErrorUnsupported(&S, "SEH __try");<br>
}<br>
+<br>
+void CodeGenFunction::EmitSEHLeaveStmt(const SEHLeaveStmt &S) {<br>
+ CGM.ErrorUnsupported(&S, "SEH __leave");<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Jul 6 19:12:30 2014<br>
@@ -173,6 +173,9 @@ void CodeGenFunction::EmitStmt(const Stm<br>
case Stmt::SEHTryStmtClass:<br>
EmitSEHTryStmt(cast<SEHTryStmt>(*S));<br>
break;<br>
+ case Stmt::SEHLeaveStmtClass:<br>
+ EmitSEHLeaveStmt(cast<SEHLeaveStmt>(*S));<br>
+ break;<br>
case Stmt::OMPParallelDirectiveClass:<br>
EmitOMPParallelDirective(cast<OMPParallelDirective>(*S));<br>
break;<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sun Jul 6 19:12:30 2014<br>
@@ -1889,6 +1889,7 @@ public:<br>
<br>
void EmitCXXTryStmt(const CXXTryStmt &S);<br>
void EmitSEHTryStmt(const SEHTryStmt &S);<br>
+ void EmitSEHLeaveStmt(const SEHLeaveStmt &S);<br>
void EmitCXXForRangeStmt(const CXXForRangeStmt &S,<br>
const ArrayRef<const Attr *> &Attrs = None);<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sun Jul 6 19:12:30 2014<br>
@@ -3285,7 +3285,7 @@ Sema::ActOnSEHLeaveStmt(SourceLocation L<br>
if (!SEHTryParent)<br>
return StmtError(Diag(Loc, diag::err_ms___leave_not_in___try));<br>
<br>
- return StmtError(Diag(Loc, diag::err_ms___leave_unimplemented));<br>
+ return new (Context) SEHLeaveStmt(Loc);<br>
}<br>
<br>
StmtResult Sema::BuildMSDependentExistsStmt(SourceLocation KeywordLoc,<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/TreeTransform.h (original)<br>
+++ cfe/trunk/lib/Sema/TreeTransform.h Sun Jul 6 19:12:30 2014<br>
@@ -6376,6 +6376,12 @@ StmtResult TreeTransform<Derived>::Trans<br>
return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));<br>
}<br>
<br>
+template<typename Derived><br>
+StmtResult<br>
+TreeTransform<Derived>::TransformSEHLeaveStmt(SEHLeaveStmt *S) {<br>
+ return S;<br>
+}<br>
+<br>
//===----------------------------------------------------------------------===//<br>
// OpenMP directive transformation<br>
//===----------------------------------------------------------------------===//<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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Sun Jul 6 19:12:30 2014<br>
@@ -1609,6 +1609,11 @@ void ASTStmtReader::VisitCXXUuidofExpr(C<br>
E->setExprOperand(Reader.ReadSubExpr());<br>
}<br>
<br>
+void ASTStmtReader::VisitSEHLeaveStmt(SEHLeaveStmt *S) {<br>
+ VisitStmt(S);<br>
+ S->setLeaveLoc(ReadSourceLocation(Record, Idx));<br>
+}<br>
+<br>
void ASTStmtReader::VisitSEHExceptStmt(SEHExceptStmt *S) {<br>
VisitStmt(S);<br>
S->Loc = ReadSourceLocation(Record, Idx);<br>
@@ -2381,6 +2386,9 @@ Stmt *ASTReader::ReadStmtFromStream(Modu<br>
case EXPR_OBJC_BOOL_LITERAL:<br>
S = new (Context) ObjCBoolLiteralExpr(Empty);<br>
break;<br>
+ case STMT_SEH_LEAVE:<br>
+ S = new (Context) SEHLeaveStmt(Empty);<br>
+ break;<br>
case STMT_SEH_EXCEPT:<br>
S = new (Context) SEHExceptStmt(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=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Sun Jul 6 19:12:30 2014<br>
@@ -1650,6 +1650,12 @@ void ASTStmtWriter::VisitSEHTryStmt(SEHT<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>
// OpenMP Clauses.<br>
//===----------------------------------------------------------------------===//<br>
<br>
Modified: cfe/trunk/test/CodeGen/exceptions-seh.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGen/exceptions-seh.c (original)<br>
+++ cfe/trunk/test/CodeGen/exceptions-seh.c Sun Jul 6 19:12:30 2014<br>
@@ -7,6 +7,7 @@ int SaveDiv(int numerator, int denominat<br>
int myres = 0;<br>
__try {<br>
myres = numerator / denominator;<br>
+ __leave;<br>
} __except (1) {<br>
return 0;<br>
}<br>
<br>
Modified: cfe/trunk/test/Sema/__try.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/__try.c?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/__try.c?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Sema/__try.c (original)<br>
+++ cfe/trunk/test/Sema/__try.c Sun Jul 6 19:12:30 2014<br>
@@ -171,21 +171,18 @@ void TEST() {<br>
(void)AbnormalTermination(); // expected-error{{only allowed in __finally block}}<br>
}<br>
<br>
-void test___leave() {<br>
+void test_seh_leave_stmt() {<br>
__leave; // expected-error{{'__leave' statement not in __try block}}<br>
<br>
__try {<br>
- // FIXME: should be fine<br>
- __leave; // expected-error{{not implemented yet}}<br>
- // FIXME: should say "expected ';' after __leave statement"<br>
- __leave 4; // expected-error{{not implemented yet}} expected-warning{{expression result unused}}<br>
+ __leave;<br>
+ __leave 4; // expected-error{{expected ';' after __leave statement}}<br>
} __except(1) {<br>
__leave; // expected-error{{'__leave' statement not in __try block}}<br>
}<br>
<br>
__try {<br>
- // FIXME: should be fine<br>
- __leave; // expected-error{{not implemented yet}}<br>
+ __leave;<br>
} __finally {<br>
__leave; // expected-error{{'__leave' statement not in __try block}}<br>
}<br>
<br>
Modified: cfe/trunk/tools/libclang/CIndex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/libclang/CIndex.cpp (original)<br>
+++ cfe/trunk/tools/libclang/CIndex.cpp Sun Jul 6 19:12:30 2014<br>
@@ -3893,6 +3893,8 @@ CXString clang_getCursorKindSpelling(enu<br>
return cxstring::createRef("SEHExceptStmt");<br>
case CXCursor_SEHFinallyStmt:<br>
return cxstring::createRef("SEHFinallyStmt");<br>
+ case CXCursor_SEHLeaveStmt:<br>
+ return cxstring::createRef("SEHLeaveStmt");<br>
case CXCursor_NullStmt:<br>
return cxstring::createRef("NullStmt");<br>
case CXCursor_InvalidFile:<br>
<br>
Modified: cfe/trunk/tools/libclang/CXCursor.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=212425&r1=212424&r2=212425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=212425&r1=212424&r2=212425&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)<br>
+++ cfe/trunk/tools/libclang/CXCursor.cpp Sun Jul 6 19:12:30 2014<br>
@@ -215,6 +215,10 @@ CXCursor cxcursor::MakeCXCursor(const St<br>
case Stmt::SEHFinallyStmtClass:<br>
K = CXCursor_SEHFinallyStmt;<br>
break;<br>
+<br>
+ case Stmt::SEHLeaveStmtClass:<br>
+ K = CXCursor_SEHLeaveStmt;<br>
+ break;<br>
<br>
case Stmt::ArrayTypeTraitExprClass:<br>
case Stmt::AsTypeExprClass:<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>
</blockquote></div><br></div>