summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Wennborg <hans@chromium.org>2020-03-18 09:35:07 +0100
committerHans Wennborg <hans@chromium.org>2020-03-18 09:35:07 +0100
commit26c762df6c48ae6bb66f76ab7e7e97bbc922ae03 (patch)
treea2512ff3745a380c07b23053fca7603c297b4e0f
parent135744ce689569e7c64033bb5812572d3000239b (diff)
downloadbcm5719-llvm-26c762df6c48ae6bb66f76ab7e7e97bbc922ae03.tar.gz
bcm5719-llvm-26c762df6c48ae6bb66f76ab7e7e97bbc922ae03.zip
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.
-rw-r--r--clang/include/clang/Sema/Sema.h6
-rw-r--r--clang/lib/Parse/ParseDecl.cpp6
-rw-r--r--clang/lib/Parse/ParseTemplate.cpp3
-rwxr-xr-xclang/lib/Sema/SemaTemplate.cpp13
-rw-r--r--clang/test/SemaCXX/invalid-member-expr.cpp1
-rw-r--r--clang/test/SemaCXX/typo-correction.cpp5
-rw-r--r--clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp1
7 files changed, 10 insertions, 25 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 842e4960227..033f7af6f2f 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6885,8 +6885,7 @@ public:
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 @@ public:
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 6353e14bc41..cdc3506d5c6 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 609640576e9..3bc4e3596f1 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 c38c724ed9b..4f577a3cf74 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 e0b40794a0c..920d92380e6 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 92a145074e7..33dea4d36b3 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 cb497176ff0..a41248ee1b8 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>
OpenPOWER on IntegriCloud