Skip to content

Commit

Permalink
should be OK for ObjCAtTryStmt, ObjCAtCatchStmt and ObjCAtFinallyStmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois Berenger committed Jul 30, 2014
1 parent f29d76f commit 2e28d88
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
6 changes: 4 additions & 2 deletions clang/clang/ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -954,10 +954,12 @@ and stmt_ = AstBridge.stmt_ =
* stmt
* decl
* (* captures *)stmt list
| ObjCAtFinallyStmt of (* body *)stmt
| ObjCAtTryStmt of (* body *)stmt
| ObjCAtCatchStmt of (* param *)decl
* (* body *)stmt
| ObjCAtFinallyStmt of (* body *)stmt
| ObjCAtTryStmt of (* try body *)stmt
* (* catch stmts *)stmt list
* (* finally body *)stmt option


| AttributedStmt
Expand Down
18 changes: 12 additions & 6 deletions clang/clang/pp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -663,16 +663,22 @@ and pp_stmt_ fmt = function
pp_stmt stmt
pp_decl decl
(Formatx.pp_list pp_stmt) captures
| ObjCAtFinallyStmt body ->
Format.fprintf fmt "@@finally %a"
pp_stmt body
| ObjCAtTryStmt body ->
Format.fprintf fmt "@@try %a"
pp_stmt body
| ObjCAtCatchStmt (param, body) ->
Format.fprintf fmt "@@catch (%a) %a"
pp_decl param
pp_stmt body
| ObjCAtFinallyStmt body ->
Format.fprintf fmt "@@finally %a"
pp_stmt body
| ObjCAtTryStmt (try_body, catch_stmts, Some finally_body) ->
Format.fprintf fmt "@@try %a %a %a"
pp_stmt try_body
(Formatx.pp_list pp_stmt) catch_stmts
pp_stmt finally_body
| ObjCAtTryStmt (try_body, catch_stmts, None) ->
Format.fprintf fmt "@@try %a %a"
pp_stmt try_body
(Formatx.pp_list pp_stmt) catch_stmts


| OMPParallelDirective -> Format.pp_print_string fmt "<OMPParallelDirective>"
Expand Down
12 changes: 10 additions & 2 deletions plugin/c++/OCamlVisitor/Stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,17 @@ OCamlVisitor::TraverseObjCAtTryStmt (clang::ObjCAtTryStmt *S)
{
TRACE;

ptr<Stmt> body = must_traverse (S->getTryBody ());
ptr<Stmt> try_body = must_traverse (S->getTryBody ());

stack.push (mkObjCAtTryStmt (body));
list<Stmt> catch_stmts;
for (unsigned i = 0; i < S->getNumCatchStmts (); ++i)
{
catch_stmts.push_back(must_traverse (S->getCatchStmt (i)));
}

option<Stmt> finally_body = maybe_traverse (S->getFinallyStmt ());

stack.push (mkObjCAtTryStmt (try_body, catch_stmts, finally_body));

return true;
}
Expand Down

0 comments on commit 2e28d88

Please sign in to comment.