# HG changeset patch # User Kaito Tokumori # Date 1428917662 -32400 # Node ID e471d82fb99bdabf4033604411b33f4d87a8cd89 # Parent ff9ec87918d452f7fcd3992736ae02840ea46a4b add SearchCodeSegmentDeclaration() diff -r ff9ec87918d4 -r e471d82fb99b tools/clang/include/clang/Parse/Parser.h --- a/tools/clang/include/clang/Parse/Parser.h Mon Apr 13 15:18:58 2015 +0900 +++ b/tools/clang/include/clang/Parse/Parser.h Mon Apr 13 18:34:22 2015 +0900 @@ -1803,6 +1803,7 @@ ExprResult Prepare__retForGotoWithTheEnvExpr(); ExprResult Prepare__envForGotoWithTheEnvExpr(); bool isVoidFunction(); + bool SearchCodeSegmentDeclaration(std::string Name); #endif bool isDeclarationSpecifier(bool DisambiguatingWithExpression = false); diff -r ff9ec87918d4 -r e471d82fb99b tools/clang/lib/Parse/ParseCbC.cpp --- a/tools/clang/lib/Parse/ParseCbC.cpp Mon Apr 13 15:18:58 2015 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Mon Apr 13 18:34:22 2015 +0900 @@ -926,4 +926,14 @@ } return Actions.ActOnCompoundStmt(gotoLoc, Tok.getLocation(), CompoundedStmts, false); } + +/// SearchCodeSegmentDeclaration - Read tokens until we get to the specified code segment declaration. +/// If we can't find it , return false; +bool Parser::SearchCodeSegmentDeclaration(std::string Name){ + while(SkipUntil(tok::kw___code,StopBeforeMatch)){ + if(NextToken().getIdentifierInfo()->getName().str() == Name) + return true; + } + return false; +} #endif diff -r ff9ec87918d4 -r e471d82fb99b tools/clang/lib/Parse/ParseStmt.cpp --- a/tools/clang/lib/Parse/ParseStmt.cpp Mon Apr 13 15:18:58 2015 +0900 +++ b/tools/clang/lib/Parse/ParseStmt.cpp Mon Apr 13 18:34:22 2015 +0900 @@ -256,6 +256,16 @@ if (!(NextToken().is(tok::identifier) && PP.LookAhead(1).is(tok::semi)) && // C: 'goto' identifier ';' NextToken().isNot(tok::star)) { // C: 'goto' '*' expression ';' SemiError = "goto code segment"; + + if(NextToken().is(tok::identifier)){ // Probably, direct continuation. goto csName(); + LookupResult LR(Actions, NextToken().getIdentifierInfo(), NextToken().getLocation(), Actions.LookupOrdinaryName); + CXXScopeSpec SS; + Actions.LookupParsedName(LR, getCurScope(), &SS, !(Actions.getCurMethodDecl())); + if(LR.getResultKind() == LookupResult::NotFound){ + } + + } + return ParseCbCGotoStatement(Attrs, Stmts); // CbC: goto codesegment statement } #endif