changeset 87:ff9ec87918d4

move ParseCbCGotoStatement() to ParseCbC.cpp
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 13 Apr 2015 15:18:58 +0900
parents 99580de8d21d
children e471d82fb99b
files tools/clang/lib/Lex/PPDirectives.cpp tools/clang/lib/Parse/ParseCbC.cpp tools/clang/lib/Parse/ParseStmt.cpp utils/llvm-build/llvmbuild/__init__.pyc utils/llvm-build/llvmbuild/componentinfo.pyc utils/llvm-build/llvmbuild/configutil.pyc utils/llvm-build/llvmbuild/main.pyc utils/llvm-build/llvmbuild/util.pyc
diffstat 8 files changed, 45 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/lib/Lex/PPDirectives.cpp	Tue Feb 24 06:05:01 2015 +0900
+++ b/tools/clang/lib/Lex/PPDirectives.cpp	Mon Apr 13 15:18:58 2015 +0900
@@ -2546,7 +2546,7 @@
   const DirectoryLookup *CurDir;
   ModuleMap::KnownHeader SuggestedModule;
   const FileEntry *File = LookupFile(Loc, Filename, isAngled, LookupFrom, NULL, CurDir, NULL, NULL,
-				     HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule : 0);
+                                     HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule : 0);
   if (File == 0) {
     Diag(FilenameTok, diag::err_pp_file_not_found) << Filename; // setjmp.h was not found
   }
--- a/tools/clang/lib/Parse/ParseCbC.cpp	Tue Feb 24 06:05:01 2015 +0900
+++ b/tools/clang/lib/Parse/ParseCbC.cpp	Mon Apr 13 15:18:58 2015 +0900
@@ -886,4 +886,44 @@
   return Actions.getCurFunctionDecl()->getReturnType().getTypePtr()->isVoidType();
 }
 
+/// ParseCbCGotoStatement
+///       jump-statement:
+/// [CbC]   'goto' codeSegment ';'
+///
+StmtResult Parser::ParseCbCGotoStatement(ParsedAttributesWithRange &Attrs,StmtVector &Stmts) {
+  assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
+  ParseScope CompoundScope(this, Scope::DeclScope);
+  StmtVector CompoundedStmts;
+
+  SourceLocation gotoLoc = ConsumeToken();  // eat the 'goto'.
+  StmtResult gotoRes;
+  Token TokAfterGoto = Tok;
+  Stmtsp = &Stmts;
+  
+  gotoRes = ParseStatementOrDeclaration(Stmts, false);
+  if (gotoRes.get() == NULL)
+    return StmtError();
+  else if (gotoRes.get()->getStmtClass() != Stmt::CallExprClass) { // if it is not function call
+    unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, "expected identifier or codesegment call");
+    Diag(TokAfterGoto, DiagID);
+    return StmtError();
+  }
+  
+  assert((Attrs.empty() || gotoRes.isInvalid() || gotoRes.isUsable()) &&
+         "attributes on empty statement");
+  if (!(Attrs.empty() || gotoRes.isInvalid()))
+    gotoRes = Actions.ProcessStmtAttributes(gotoRes.get(), Attrs.getList(), Attrs.Range);
+  if (gotoRes.isUsable())
+    CompoundedStmts.push_back(gotoRes.get());
+
+  // add return; after goto codesegment();
+  if (Actions.getCurFunctionDecl()->getReturnType().getTypePtr()->is__CodeType()) {
+    ExprResult retExpr;
+    StmtResult retRes;
+    retRes = Actions.ActOnReturnStmt(gotoLoc, retExpr.get(), getCurScope());
+    if (retRes.isUsable())
+      CompoundedStmts.push_back(retRes.get());
+  }
+  return Actions.ActOnCompoundStmt(gotoLoc, Tok.getLocation(), CompoundedStmts, false);
+}
 #endif
--- a/tools/clang/lib/Parse/ParseStmt.cpp	Tue Feb 24 06:05:01 2015 +0900
+++ b/tools/clang/lib/Parse/ParseStmt.cpp	Mon Apr 13 15:18:58 2015 +0900
@@ -25,6 +25,10 @@
 #include "clang/Sema/TypoCorrection.h"
 #include "llvm/ADT/SmallString.h"
 
+#ifndef noCbC
+#include "clang/Sema/Lookup.h"
+#endif
+
 using namespace clang;
 
 //===----------------------------------------------------------------------===//
@@ -1771,49 +1775,6 @@
   return Res;
 }
 
-#ifndef noCbC
-/// ParseCbCGotoStatement
-///       jump-statement:
-/// [CbC]   'goto' codeSegment ';'
-///
-StmtResult Parser::ParseCbCGotoStatement(ParsedAttributesWithRange &Attrs,StmtVector &Stmts) {
-  assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
-  ParseScope CompoundScope(this, Scope::DeclScope);
-  StmtVector CompoundedStmts;
-
-  SourceLocation gotoLoc = ConsumeToken();  // eat the 'goto'.
-  StmtResult gotoRes;
-  Token TokAfterGoto = Tok;
-  Stmtsp = &Stmts;
-  
-  gotoRes = ParseStatementOrDeclaration(Stmts, false);
-  if (gotoRes.get() == NULL)
-    return StmtError();
-  else if (gotoRes.get()->getStmtClass() != Stmt::CallExprClass) { // if it is not function call
-    unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, "expected identifier or codesegment call");
-    Diag(TokAfterGoto, DiagID);
-    return StmtError();
-  }
-  
-  assert((Attrs.empty() || gotoRes.isInvalid() || gotoRes.isUsable()) &&
-         "attributes on empty statement");
-  if (!(Attrs.empty() || gotoRes.isInvalid()))
-    gotoRes = Actions.ProcessStmtAttributes(gotoRes.get(), Attrs.getList(), Attrs.Range);
-  if (gotoRes.isUsable())
-    CompoundedStmts.push_back(gotoRes.get());
-
-  // add return; after goto codesegment();
-  if (Actions.getCurFunctionDecl()->getReturnType().getTypePtr()->is__CodeType()) {
-    ExprResult retExpr;
-    StmtResult retRes;
-    retRes = Actions.ActOnReturnStmt(gotoLoc, retExpr.get(), getCurScope());
-    if (retRes.isUsable())
-      CompoundedStmts.push_back(retRes.get());
-  }
-  return Actions.ActOnCompoundStmt(gotoLoc, Tok.getLocation(), CompoundedStmts, false);
-}
-#endif
-
 /// ParseContinueStatement
 ///       jump-statement:
 ///         'continue' ';'
Binary file utils/llvm-build/llvmbuild/__init__.pyc has changed
Binary file utils/llvm-build/llvmbuild/componentinfo.pyc has changed
Binary file utils/llvm-build/llvmbuild/configutil.pyc has changed
Binary file utils/llvm-build/llvmbuild/main.pyc has changed
Binary file utils/llvm-build/llvmbuild/util.pyc has changed