# HG changeset patch # User Kaito Tokumori # Date 1454263021 -32400 # Node ID 1881386f7909844e4f319aa6641efc41272b8b35 # Parent a03ddd01be7e2c073fc1db347c6786fa4d61a07a use llvm.setjmp and llvm.longjmp diff -r a03ddd01be7e -r 1881386f7909 tools/clang/include/clang/Basic/Builtins.def --- a/tools/clang/include/clang/Basic/Builtins.def Sun Jan 31 17:34:49 2016 +0900 +++ b/tools/clang/include/clang/Basic/Builtins.def Mon Feb 01 02:57:01 2016 +0900 @@ -1278,6 +1278,10 @@ LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC_LANG) LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC_LANG) +#ifndef noCbC +BUILTIN(__builtin_CbC_setjmp, "iv**", "j") +#endif + #undef BUILTIN #undef LIBBUILTIN #undef LANGBUILTIN diff -r a03ddd01be7e -r 1881386f7909 tools/clang/lib/Parse/ParseCbC.cpp --- a/tools/clang/lib/Parse/ParseCbC.cpp Sun Jan 31 17:34:49 2016 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Mon Feb 01 02:57:01 2016 +0900 @@ -434,7 +434,7 @@ ExprResult CondExp; Decl *CondVar = 0; - CondExp = LookupNameAndBuildExpr(CreateIdentifierInfo("setjmp", Loc)); + CondExp = LookupNameAndBuildExpr(CreateIdentifierInfo("__builtin_setjmp", Loc)); ExprVector ArgExprs; ExprResult __envExprRes = CondExp.get(); @@ -539,7 +539,7 @@ SmallVector FieldDecls; FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_POINTER_NAME)); - FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_int, Loc, __CBC_STRUCT_ENV_NAME)); + FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_ENV_NAME)); Actions.ActOnFields(getCurScope(),Loc, TagDecl, FieldDecls,Loc, Loc,attrs.getList()); StructScope.Exit(); @@ -611,7 +611,7 @@ /// create these codes: /// __code ret(return_type retval, void *env){ /// *(return_type)((struct CbC_environment *)(env))->ret_p = n; -/// longjmp((int*)(((struct __CbC_environment *)env)->env),1); +/// longjmp((void*)(((struct __CbC_environment *)env)->env),1); /// } void Parser::CreateRetCS(IdentifierInfo *csName){ const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy(); @@ -730,7 +730,7 @@ FnStmts.push_back(innerR.get()); ExprResult ljExpr,ljLHS; - ljExpr = IIToExpr(CreateIdentifierInfo("longjmp", Loc), tok::l_paren); + ljExpr = IIToExpr(CreateIdentifierInfo("__builtin_longjmp", Loc), tok::l_paren); ExprVector ljArgExprs; DeclSpec ljDS(AttrFactory); setTST(&ljDS, DeclSpec::TST_struct, structName);