[llvm-branch-commits] [clang] 26c762d - Revert "[Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint annotates an invalid template-id"

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 18 01:57:45 PDT 2020


Author: Hans Wennborg
Date: 2020-03-18T09:35:07+01:00
New Revision: 26c762df6c48ae6bb66f76ab7e7e97bbc922ae03

URL: https://github.com/llvm/llvm-project/commit/26c762df6c48ae6bb66f76ab7e7e97bbc922ae03
DIFF: https://github.com/llvm/llvm-project/commit/26c762df6c48ae6bb66f76ab7e7e97bbc922ae03.diff

LOG: Revert "[Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint annotates an invalid template-id"

We're not planning more release candidates for 10.0.0 at the moment, so
reverting for now.

This reverts commit 135744ce689569e7c64033bb5812572d3000239b.

Added: 
    

Modified: 
    clang/include/clang/Sema/Sema.h
    clang/lib/Parse/ParseDecl.cpp
    clang/lib/Parse/ParseTemplate.cpp
    clang/lib/Sema/SemaTemplate.cpp
    clang/test/SemaCXX/invalid-member-expr.cpp
    clang/test/SemaCXX/typo-correction.cpp
    clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 842e49602274..033f7af6f2f3 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6885,8 +6885,7 @@ class Sema final {
                           QualType ObjectType, bool EnteringContext,
                           bool &MemberOfUnknownSpecialization,
                           SourceLocation TemplateKWLoc = SourceLocation(),
-                          AssumedTemplateKind *ATK = nullptr,
-                          bool Disambiguation = false);
+                          AssumedTemplateKind *ATK = nullptr);
 
   TemplateNameKind isTemplateName(Scope *S,
                                   CXXScopeSpec &SS,
@@ -6895,8 +6894,7 @@ class Sema final {
                                   ParsedType ObjectType,
                                   bool EnteringContext,
                                   TemplateTy &Template,
-                                  bool &MemberOfUnknownSpecialization,
-                                  bool Disambiguation = false);
+                                  bool &MemberOfUnknownSpecialization);
 
   /// Try to resolve an undeclared template name as a type template.
   ///

diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 6353e14bc41a..cdc3506d5c68 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3252,9 +3252,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
           goto DoneWithDeclSpec;
         if (isTypeConstraintAnnotation())
           continue;
-        if (NextToken().is(tok::annot_template_id))
-          // Might have been annotated by TryAnnotateTypeConstraint.
-          continue;
         // Eat the scope spec so the identifier is current.
         ConsumeAnnotationToken();
         ParsedAttributesWithRange Attrs(AttrFactory);
@@ -3408,9 +3405,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
           goto DoneWithDeclSpec;
         if (isTypeConstraintAnnotation())
           continue;
-        if (Tok.is(tok::annot_template_id))
-          // Might have been annotated by TryAnnotateTypeConstraint.
-          continue;
         ParsedAttributesWithRange Attrs(AttrFactory);
         if (ParseImplicitInt(DS, nullptr, TemplateInfo, AS, DSContext, Attrs)) {
           if (!Attrs.empty()) {

diff  --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 609640576e9e..3bc4e3596f12 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -710,8 +710,7 @@ bool Parser::TryAnnotateTypeConstraint() {
                                       /*ObjectType=*/ParsedType(),
                                       /*EnteringContext=*/false,
                                       PossibleConcept,
-                                      MemberOfUnknownSpecialization,
-                                      /*Disambiguation=*/true);
+                                      MemberOfUnknownSpecialization);
     if (MemberOfUnknownSpecialization || !PossibleConcept ||
         TNK != TNK_Concept_template) {
       if (SS.isNotEmpty())

diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index c38c724ed9b0..4f577a3cf748 100755
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -174,8 +174,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
                                       ParsedType ObjectTypePtr,
                                       bool EnteringContext,
                                       TemplateTy &TemplateResult,
-                                      bool &MemberOfUnknownSpecialization,
-                                      bool Disambiguation) {
+                                      bool &MemberOfUnknownSpecialization) {
   assert(getLangOpts().CPlusPlus && "No template names in C!");
 
   DeclarationName TName;
@@ -205,7 +204,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
   LookupResult R(*this, TName, Name.getBeginLoc(), LookupOrdinaryName);
   if (LookupTemplateName(R, S, SS, ObjectType, EnteringContext,
                          MemberOfUnknownSpecialization, SourceLocation(),
-                         &AssumedTemplate, Disambiguation))
+                         &AssumedTemplate))
     return TNK_Non_template;
 
   if (AssumedTemplate != AssumedTemplateKind::None) {
@@ -372,8 +371,7 @@ bool Sema::LookupTemplateName(LookupResult &Found,
                               bool EnteringContext,
                               bool &MemberOfUnknownSpecialization,
                               SourceLocation TemplateKWLoc,
-                              AssumedTemplateKind *ATK,
-                              bool Disambiguation) {
+                              AssumedTemplateKind *ATK) {
   if (ATK)
     *ATK = AssumedTemplateKind::None;
 
@@ -496,9 +494,8 @@ bool Sema::LookupTemplateName(LookupResult &Found,
     }
   }
 
-  if (Found.empty() && !IsDependent && !Disambiguation) {
-    // If we did not find any names, and this is not a disambiguation, attempt
-    // to correct any typos.
+  if (Found.empty() && !IsDependent) {
+    // If we did not find any names, attempt to correct any typos.
     DeclarationName Name = Found.getLookupName();
     Found.clear();
     // Simple filter callback that, for keywords, only accepts the C++ *_cast

diff  --git a/clang/test/SemaCXX/invalid-member-expr.cpp b/clang/test/SemaCXX/invalid-member-expr.cpp
index e0b40794a0ce..920d92380e69 100644
--- a/clang/test/SemaCXX/invalid-member-expr.cpp
+++ b/clang/test/SemaCXX/invalid-member-expr.cpp
@@ -1,7 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
 
 class X {};
 

diff  --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp
index 92a145074e72..33dea4d36b3e 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions %s
-// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -std=c++20 %s
 
 namespace PR21817{
 int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}}
@@ -524,8 +523,8 @@ PR18685::BitVector Map;  // expected-error-re {{no type named 'BitVector' in nam
 namespace shadowed_template {
 template <typename T> class Fizbin {};  // expected-note {{'::shadowed_template::Fizbin' declared here}}
 class Baz {
-   int Fizbin;
-   Fizbin<int> qux; // expected-error {{no template named 'Fizbin'; did you mean '::shadowed_template::Fizbin'?}}
+   int Fizbin();
+   Fizbin<int> qux;  // expected-error {{no template named 'Fizbin'; did you mean '::shadowed_template::Fizbin'?}}
 };
 }
 

diff  --git a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
index cb497176ff0e..a41248ee1b8e 100644
--- a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
+++ b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++1y -fms-compatibility -fno-spell-checking -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++20 -fms-compatibility -fno-spell-checking -fsyntax-only -verify %s
 
 
 template <class T>


        


More information about the llvm-branch-commits mailing list