Mercurial > hg > CbC > CbC_llvm
changeset 194:f2ef29ba5fe2
try to remove setjmp.h start
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 22 Mar 2021 18:10:23 +0900 |
parents | 65ec4991372c |
children | c7eaafae97e2 |
files | clang/include/clang/Parse/Parser.h clang/lib/Parse/ParseCbC.cpp |
diffstat | 2 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/clang/include/clang/Parse/Parser.h Mon Dec 14 18:12:20 2020 +0900 +++ b/clang/include/clang/Parse/Parser.h Mon Mar 22 18:10:23 2021 +0900 @@ -2359,7 +2359,7 @@ StmtResult CreateSjForContinuationWithTheEnv(); StmtResult CreateAssignmentStmt(IdentifierInfo* LHSII = 0, IdentifierInfo* RHSII = 0, bool LHSisMemberAccess = false, bool RHShasAmp = false, IdentifierInfo* extraLHSII = 0, IdentifierInfo* extraRHSII = 0); - StmtResult CreateDeclStmt(IdentifierInfo *II = 0, bool isRetCS = false, bool copyType = false, DeclSpec::TST valueType = DeclSpec::TST_int, IdentifierInfo* Name = 0, DeclSpec::TQ TQ = DeclSpec::TQ_unspecified); + StmtResult CreateDeclStmt(IdentifierInfo *II = 0, bool isRetCS = false, bool copyType = false, int array = 0, DeclSpec::TST valueType = DeclSpec::TST_int, IdentifierInfo* Name = 0, DeclSpec::TQ TQ = DeclSpec::TQ_unspecified); IdentifierInfo* CreateUniqueIdentifierInfo(const char* Name, SourceLocation Loc); ParmVarDecl* CreateParam(IdentifierInfo *II = 0, int pointerNum = 0, DeclSpec::TST T = DeclSpec::TST_int); Decl* HandleDeclAndChangeDeclType(Declarator &D);
--- a/clang/lib/Parse/ParseCbC.cpp Mon Dec 14 18:12:20 2020 +0900 +++ b/clang/lib/Parse/ParseCbC.cpp Mon Mar 22 18:10:23 2021 +0900 @@ -165,7 +165,7 @@ CreateRetCS(retcsII); // __code (*__CbC_return)(); - innerRes = CreateDeclStmt(__CbC_retII, true, false, DeclSpec::TST___code); + innerRes = CreateDeclStmt(__CbC_retII, true, false, 0, DeclSpec::TST___code); if (innerRes.isUsable()) CompoundStmts.push_back(innerRes.get()); @@ -192,7 +192,7 @@ /// complex statement: /// ({ /// volatile struct __CbC_env __CbC_environment; -/// jmp_buf env_buf; +/// jmp_buf env_buf; --> int env_buf[64]; /// return_type retval; /// __CbC_environment.ret_p = &retval; /// __CbC_environment.env = &env_buf; @@ -230,7 +230,7 @@ ExprResult Result(true); // struct __CbC_env __CbC_environment; - innerRes = CreateDeclStmt(__CbC_envII, false, false, DeclSpec::TST_struct, structII, DeclSpec::TQ_volatile); + innerRes = CreateDeclStmt(__CbC_envII, false, false, 0, DeclSpec::TST_struct, structII, DeclSpec::TQ_volatile); if (innerRes.isUsable()) CompoundStmts.push_back(innerRes.get()); @@ -239,8 +239,8 @@ if (innerRes.isUsable()) CompoundStmts.push_back(innerRes.get()); - // jmp_buf env_buf; - innerRes = CreateDeclStmt(bufII, false, false, DeclSpec::TST_typename, CreateIdentifierInfo("jmp_buf", Loc)); + // jmp_buf env_buf; --> int env_buf[64]; + innerRes = CreateDeclStmt(bufII, false, false, 64, DeclSpec::TST_typename, CreateIdentifierInfo("int", Loc)); if (innerRes.isUsable()) CompoundStmts.push_back(innerRes.get()); @@ -341,7 +341,7 @@ /// CreateDeclStmt - Create declaration statement such as "int aaa;". /// If isRetCS is true, create code segment for return to C's function. And Name is name of code segment. /// If copyType is true, type of variable is copied from callee. -StmtResult Parser::CreateDeclStmt(IdentifierInfo *II, bool isRetCS, bool copyType, DeclSpec::TST valueType, IdentifierInfo* Name, DeclSpec::TQ TQ){ +StmtResult Parser::CreateDeclStmt(IdentifierInfo *II, bool isRetCS, bool copyType, int array, DeclSpec::TST valueType, IdentifierInfo* Name, DeclSpec::TQ TQ){ const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy(); SourceLocation Loc = Tok.getLocation(); DeclGroupPtrTy DeclGPT; @@ -353,6 +353,11 @@ ParsingDeclarator D(*this, DS, static_cast<DeclaratorContext>(DeclaratorContext::BlockContext)); D.SetIdentifier(II, Loc); + if (array) { + DeclSpec FDS(AttrFactory); + D.AddTypeInfo(DeclaratorChunk::getArray(0,false,false,Actions.ActOnIntegerConstant(Loc,array).get(),Loc, FDS.getConstSpecLoc() ), + std::move(FDS.getAttributes()), SourceLocation()); + } if (isRetCS) { D.setEllipsisLoc(SourceLocation()); bool hadGroupingParens = D.hasGroupingParens(); @@ -982,12 +987,14 @@ /// CheckTheSjHeader - Check whether setjmp.h has been already included or not. /// If not, include it. void Parser::CheckTheSjHeader(){ +#if 0 SourceLocation Loc = Tok.getLocation(); LookupResult R(Actions, CreateIdentifierInfo("setjmp", Loc), Loc, Actions.LookupOrdinaryName, Actions.ForVisibleRedeclaration); if (!Actions.LookupName(R, getCurScope())){ // look up the setjmp if (PP.IncludeHeader(Tok, "setjmp.h")) ConsumeToken(); } +#endif } /// isVoidFunction - Return true if current function return type is void.