diff tools/clang/lib/Parse/ParseCbC.cpp @ 108:1881386f7909

use llvm.setjmp and llvm.longjmp
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 01 Feb 2016 02:57:01 +0900
parents a03ddd01be7e
children c4cc77a799c9
line wrap: on
line diff
--- 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<Decl *, 32> 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);