Skip to content

Commit f26b7a0

Browse files
committed
Remove support for '^ splice-expression' production.
1 parent 149cca5 commit f26b7a0

File tree

3 files changed

+5
-141
lines changed

3 files changed

+5
-141
lines changed

clang/lib/Parse/ParseReflect.cpp

+5-60
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,14 @@ ExprResult Parser::ParseCXXReflectExpression() {
2626
EnterExpressionEvaluationContext EvalContext(
2727
Actions, Sema::ExpressionEvaluationContext::ReflectionContext);
2828

29-
// ^ template [:splice-specifier:]
30-
//
31-
SourceLocation TemplateKWLoc;
32-
if (Tok.is(tok::kw_template)) {
33-
TemplateKWLoc = ConsumeToken();
34-
35-
if (!Tok.is(tok::l_splice)) {
36-
Diag(TemplateKWLoc, diag::err_unexpected_template_in_unqualified_id);
37-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
38-
return ExprError();
39-
}
40-
41-
if (ParseCXXSpliceSpecifier(TemplateKWLoc)) {
42-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
43-
return ExprError();
44-
}
45-
46-
if (!NextToken().is(tok::less)) {
47-
Token Splice = Tok;
48-
TemplateTy Template = ParseCXXSpliceAsTemplate();
49-
if (Template)
50-
return Actions.BuildCXXReflectExpr(OpLoc, Splice.getLocation(),
51-
Template.get());
52-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
53-
return ExprError();
54-
}
55-
56-
if (ParseTemplateAnnotationFromSplice(SourceLocation(), false, false,
57-
/*Complain=*/true)) {
58-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
59-
return ExprError();
60-
}
61-
}
62-
63-
6429
// Parse a leading nested-name-specifier, e.g.,
6530
//
6631
CXXScopeSpec SS;
67-
if (TemplateKWLoc.isInvalid()) {
68-
if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/nullptr,
69-
/*ObjectHasErrors=*/false,
70-
/*EnteringContext=*/false)) {
71-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
72-
return ExprError();
73-
}
32+
if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/nullptr,
33+
/*ObjectHasErrors=*/false,
34+
/*EnteringContext=*/false)) {
35+
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
36+
return ExprError();
7437
}
7538

7639
// Start the tentative parse: This will be reverted if the operand is found
@@ -79,24 +42,6 @@ ExprResult Parser::ParseCXXReflectExpression() {
7942
//
8043
TentativeParsingAction TentativeAction(*this);
8144

82-
// ^ [:splice-specifier:]
83-
//
84-
if (!SS.isSet() && Tok.is(tok::annot_splice)) {
85-
assert(TemplateKWLoc.isInvalid());
86-
87-
ExprResult ER = getExprAnnotation(Tok);
88-
assert(!ER.isInvalid());
89-
ER = ParseCXXSpliceAsExpr(true);
90-
if (ER.isInvalid()) {
91-
TentativeAction.Commit();
92-
SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch);
93-
return ExprError();
94-
}
95-
96-
TentativeAction.Commit();
97-
return Actions.ActOnCXXReflectExpr(OpLoc, cast<CXXSpliceExpr>(ER.get()));
98-
}
99-
10045
// Next, check for an unqualified-id.
10146
if (Tok.isOneOf(tok::identifier, tok::kw_operator, tok::kw_template,
10247
tok::tilde, tok::annot_template_id)) {

clang/test/Reflection/reflection-of-splice.cpp

-71
This file was deleted.

clang/test/Reflection/splice-templates.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,12 @@ struct S {
3636
template <typename T> static constexpr int TMemVar = 0;
3737
};
3838

39-
static_assert(^template [:^TCls:] == ^TCls);
40-
static_assert(^typename [:^TCls:]<int> == ^TCls<int>);
41-
static_assert(^template [:^TCls:]<int> == ^typename [:^TCls:]<int>);
4239
static_assert(is_same_v<typename [:^TCls:]<int>, TCls<int>>);
43-
static_assert(^typename [:^TAlias:]<int> == ^TAlias<int>);
4440
static_assert(is_same_v<typename [:^TAlias:]<int>, TCls<int>>);
45-
static_assert(^template [:^TFn:] == ^TFn);
46-
static_assert(^template [:^TFn:]<int> == ^TFn<int>);
4741
static_assert(&template [:^TFn:]<int> == &TFn<int>);
48-
static_assert(^template [:^TVar:]<int> == ^TVar<int>);
4942
static_assert(&template [:^TVar:]<int> == &TVar<int>);
50-
static_assert(^template [:^S::TInner:]<int> == ^S::TInner<int>);
5143
static_assert(is_same_v<typename [:^S::TInner:]<int>, S::TInner<int>>);
52-
static_assert(^template [:^S::TFn:]<int> == ^S::TFn<int>);
5344
static_assert(&template [:^S::TFn:]<int> == &S::TFn<int>);
54-
static_assert(^template [:^S::TMemVar:]<int> == ^S::TMemVar<int>);
5545
static_assert(&template [:^S::TMemVar:]<int> == &S::TMemVar<int>);
5646
} // namespace idempotency
5747

0 commit comments

Comments
 (0)