saar.raz updated this revision to Diff 238478.
saar.raz marked 21 inline comments as done.
saar.raz added a comment.

Address CR comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65042/new/

https://reviews.llvm.org/D65042

Files:
  .gitignore
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseTemplate.cpp
  clang/test/SemaTemplate/ms-delayed-default-template-args.cpp

Index: clang/test/SemaTemplate/ms-delayed-default-template-args.cpp
===================================================================
--- clang/test/SemaTemplate/ms-delayed-default-template-args.cpp
+++ clang/test/SemaTemplate/ms-delayed-default-template-args.cpp
@@ -94,6 +94,7 @@
 template <typename T> struct Bar { T x; };
 
 template <Bar<Xylophone> *P> // expected-error {{use of undeclared identifier 'Xylophone'}}
+// expected-note@-1{{template parameter is declared here}}
 struct Foo { };
 
 typedef int Xylophone;
Index: clang/lib/Parse/ParseTemplate.cpp
===================================================================
--- clang/lib/Parse/ParseTemplate.cpp
+++ clang/lib/Parse/ParseTemplate.cpp
@@ -501,7 +501,7 @@
 
 /// Determine whether the parser is at the start of a template
 /// type parameter.
-/// \param ScopeError will receive true if there was a parsing error.
+/// \param Error will receive true if there was a parsing error.
 bool Parser::isStartOfTemplateTypeParameter(bool &Error) {
   Error = false;
   if (Tok.is(tok::kw_class)) {
@@ -611,8 +611,8 @@
   // type-constraint is in fact part of a placeholder-type-specifier of a
   // non-type template parameter.
 
-  bool ScopeError;
-  if (isStartOfTemplateTypeParameter(ScopeError)) {
+  bool Error;
+  if (isStartOfTemplateTypeParameter(Error)) {
     // Is there just a typo in the input code? ('typedef' instead of
     // 'typename')
     if (Tok.is(tok::kw_typedef)) {
@@ -629,7 +629,7 @@
 
     return ParseTypeParameter(Depth, Position);
   }
-  if (ScopeError) {
+  if (Error) {
     // We return an invalid parameter as opposed to null to avoid having bogus
     // diagnostics about an empty template parameter list.
     // FIXME: Fix ParseTemplateParameterList to better handle nullptr results
@@ -679,7 +679,7 @@
 /// \returns true if an error occurred, and false otherwise.
 bool Parser::TryAnnotateTypeConstraint(CXXScopeSpec &SS) {
   if (!getLangOpts().ConceptsTS)
-    return true;
+    return false;
   if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(),
                                      /*EnteringContext=*/false,
                                      /*MayBePseudoDestructor=*/nullptr,
Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3472,13 +3472,12 @@
         ConsumeAnnotationToken();
         SourceLocation AutoLoc = Tok.getLocation();
         if (TryConsumeToken(tok::kw_decltype)) {
-          if (!Tok.is(tok::l_paren)) {
+          BalancedDelimiterTracker Tracker(*this, tok::l_paren);
+          if (Tracker.consumeOpen()) {
             // Something like `void foo(Iterator decltype i)`
             Diag(Tok, diag::err_expected) << tok::l_paren;
           } else {
-            BalancedDelimiterTracker Tracker(*this, tok::l_paren);
-            Tracker.consumeOpen();
-            if (!ExpectAndConsume(tok::kw_auto)) {
+            if (!TryConsumeToken(tok::kw_auto)) {
               // Something like `void foo(Iterator decltype(int) i)`
               Tracker.skipToEnd();
               Diag(Tok, diag::err_placeholder_decltype_non_auto)
@@ -3489,6 +3488,7 @@
               Tracker.consumeClose();
             }
           }
+          ConsumedEnd = Tok.getLocation();
           // Even if something went wrong above, continue as if we've seen
           // `decltype(auto)`.
           isInvalid = DS.SetTypeSpecType(TST_decltype_auto, Loc, PrevSpec,
Index: clang/include/clang/Parse/Parser.h
===================================================================
--- clang/include/clang/Parse/Parser.h
+++ clang/include/clang/Parse/Parser.h
@@ -3079,7 +3079,7 @@
                                SourceLocation &RAngleLoc);
   bool ParseTemplateParameterList(unsigned Depth,
                                   SmallVectorImpl<NamedDecl*> &TemplateParams);
-  bool isStartOfTemplateTypeParameter(bool &ScopeError);
+  bool isStartOfTemplateTypeParameter(bool &Error);
   NamedDecl *ParseTemplateParameter(unsigned Depth, unsigned Position);
   NamedDecl *ParseTypeParameter(unsigned Depth, unsigned Position);
   NamedDecl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position);
Index: .gitignore
===================================================================
--- .gitignore
+++ .gitignore
@@ -54,7 +54,3 @@
 .vs
 # clangd index
 .clangd
-<<<<<<< Updated upstream
-=======
-clang/\.idea/
->>>>>>> Stashed changes
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D65042: [... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D650... Saar Raz via Phabricator via cfe-commits
    • [PATCH] D650... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D650... Jonas Devlieghere via Phabricator via cfe-commits

Reply via email to