changeset 160:dbfec6499728

...
author anatofuz
date Wed, 18 Mar 2020 19:11:03 +0900
parents cbec8b90714d
children c936242a6e27
files clang/lib/Lex/PPDirectives.cpp clang/lib/Parse/ParseCbC.cpp
diffstat 2 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/clang/lib/Lex/PPDirectives.cpp	Tue Mar 17 17:39:02 2020 +0900
+++ b/clang/lib/Lex/PPDirectives.cpp	Wed Mar 18 19:11:03 2020 +0900
@@ -3129,12 +3129,12 @@
   ModuleMap::KnownHeader SuggestedModule;
   Optional <FileEntryRef> File = LookupFile(Loc, Filename, isAngled, LookupFrom, nullptr, CurDir, nullptr, nullptr,
                                      &SuggestedModule, &IsMapped, nullptr);
-  if (File == 0) {
+  if (!File) {
     Diag(FilenameTok, diag::err_pp_file_not_found) << Filename; // setjmp.h was not found
   }
-  SrcMgr::CharacteristicKind FileCharacter = std::max(HeaderInfo.getFileDirFlavor(&File->getFleEntry()), SourceMgr.getFileCharacteristic(Loc));
-
-  if (!HeaderInfo.ShouldEnterIncludeFile(*this, File, false, false, SuggestedModule.getModule())) {
+  SrcMgr::CharacteristicKind FileCharacter = std::max(HeaderInfo.getFileDirFlavor(&File->getFileEntry()), SourceMgr.getFileCharacteristic(Loc));
+
+  if (!HeaderInfo.ShouldEnterIncludeFile(*this, &File->getFileEntry(), false, false, SuggestedModule.getModule())) {
     return false;
   }
 
--- 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());