diff clang/lib/Parse/ParseCbC.cpp @ 160:dbfec6499728

...
author anatofuz
date Wed, 18 Mar 2020 19:11:03 +0900 (2020-03-18)
parents cbec8b90714d
children c936242a6e27
line wrap: on
line diff
--- a/clang/lib/Parse/ParseCbC.cpp	Tue Mar 17 17:39:02 2020 +0900
+++ b/clang/lib/Parse/ParseCbC.cpp	Wed Mar 18 19:11:03 2020 +0900
@@ -293,8 +293,8 @@
   LHSToken.setLocation(Loc);
   LHSToken.setIdentifierInfo(LHSII);
   LHSToken.setKind(tok::annot_primary_expr);
-  std::unique_ptr<ExternalSpace::StatementFilterCCC> Validator(new ExternalSpace::StatementFilterCCC(Next));
-  Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, LHSII, Loc, Next, false, SS.isEmpty() ? std::move(Validator) : 0);
+  StatementFilterCCC Validator(Next);
+  Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, LHSII, Loc, Next, SS.isEmpty() ? Validator : 0);
   setExprAnnotation(LHSToken, Classification.getExpression());
   LHSToken.setAnnotationEndLoc(Loc);
   PP.AnnotateCachedTokens(LHSToken);
@@ -514,9 +514,9 @@
   UnqualifiedId Name;
   CXXScopeSpec SS;
   SourceLocation TemplateKWLoc;
-  std::unique_ptr<ExternalSpace::CastExpressionIdValidator> Validator(new ExternalSpace::CastExpressionIdValidator(false,true));
+  StatementFilterCCC Validator(Next);
   Name.setIdentifier(II, Loc);
-  return Actions.ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Name, false, IsAddressOfOperand, std::move(Validator));
+  return Actions.ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Name, false, IsAddressOfOperand, Validator);
 }
 
 /// LookupMemberAndBuildExpr - Look up member name, create ExprResult and return it.
@@ -567,7 +567,7 @@
   MultiTemplateParamsArg TParams;
       
   TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, Sema::TUK_Definition, Loc,
-                                     SDS.getTypeSpecScope(), Name, Loc, attrs.getList(), AS,
+                                     SDS.getTypeSpecScope(), Name, Loc, attrs, AS,
                                      SDS.getModulePrivateSpecLoc(), TParams, Owned, IsDependent,
                                      SourceLocation(), false, clang::TypeResult(), false, false);
 
@@ -580,7 +580,7 @@
   FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_POINTER_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());
+  Actions.ActOnFields(getCurScope(),Loc, TagDecl, FieldDecls,Loc, Loc,attrs);
   StructScope.Exit();
   Actions.ActOnTagFinishDefinition(getCurScope(), TagDecl, Loc);
 
@@ -899,7 +899,7 @@
     bool IsDependent = false;
     MultiTemplateParamsArg TParams;
     TagOrTempResult = Actions.ActOnTag(getCurScope(), T, Sema::TUK_Reference, Loc,
-                                       SS, Name, Loc, attrs.getList(), AS_none,
+                                       SS, Name, Loc, attrs, AS_none,
                                        DS->getModulePrivateSpecLoc(),
                                        TParams, Owned, IsDependent,
                                        SourceLocation(), false,
@@ -968,8 +968,14 @@
   StmtResult gotoRes;
   Token TokAfterGoto = Tok;
   Stmtsp = &Stmts;
+
+ 
+  ParsedStmtContext SubStmtCtx =
+     ParsedStmtContext::Compound  |  ParsedStmtContext::InStmtExpr; // unconfident
+
+
   
-  gotoRes = ParseStatementOrDeclaration(Stmts, ACK_Any);
+  gotoRes = ParseStatementOrDeclaration(Stmts, SubStmtCtx);
 
   if (gotoRes.get() == NULL)
     return StmtError();
@@ -982,7 +988,7 @@
   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);
+    gotoRes = Actions.ProcessStmtAttributes(gotoRes.get(), Attrs, Attrs.Range);
   if (gotoRes.isUsable())
     CompoundedStmts.push_back(gotoRes.get());