Skip to content

Commit 76d6615

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:ad1ca5f4a2bc into origin/amd-gfx:b6266caaf444
Local branch origin/amd-gfx b6266ca Merged main:c30776ab9a14 into origin/amd-gfx:7e0640a99a92 Remote branch main ad1ca5f [clang] Concepts: support pack expansions for type constraints (llvm#132626)
2 parents b6266ca + ad1ca5f commit 76d6615

File tree

368 files changed

+15391
-6739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+15391
-6739
lines changed

.ci/compute_projects.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
200200
# documentation builds.
201201
if len(path_parts) > 2 and path_parts[1] == "docs":
202202
continue
203+
# Exclude files for the gn build. We do not test it within premerge
204+
# and changes occur often enough that they otherwise take up
205+
# capacity.
206+
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
207+
continue
203208
modified_projects.add(pathlib.Path(modified_file).parts[0])
204209
return modified_projects
205210

.ci/compute_projects_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ def test_exclude_docs(self):
179179
self.assertEqual(env_variables["runtimes_to_build"], "")
180180
self.assertEqual(env_variables["runtimes_check_targets"], "")
181181

182+
def test_exclude_gn(self):
183+
env_variables = compute_projects.get_env_variables(
184+
["llvm/utils/gn/build/BUILD.gn"], "Linux"
185+
)
186+
self.assertEqual(env_variables["projects_to_build"], "")
187+
self.assertEqual(env_variables["project_check_targets"], "")
188+
self.assertEqual(env_variables["runtimes_to_build"], "")
189+
self.assertEqual(env_variables["runtimes_check_targets"], "")
190+
182191

183192
if __name__ == "__main__":
184193
unittest.main()

clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static std::vector<FixItHint> handleReturnType(const FunctionDecl *Function,
356356
if (!TypeText)
357357
return {};
358358

359-
SmallVector<const Expr *, 3> ExistingConstraints;
359+
SmallVector<AssociatedConstraint, 3> ExistingConstraints;
360360
Function->getAssociatedConstraints(ExistingConstraints);
361361
if (!ExistingConstraints.empty()) {
362362
// FIXME - Support adding new constraints to existing ones. Do we need to
@@ -404,7 +404,7 @@ handleTrailingTemplateType(const FunctionTemplateDecl *FunctionTemplate,
404404
if (!ConditionText)
405405
return {};
406406

407-
SmallVector<const Expr *, 3> ExistingConstraints;
407+
SmallVector<AssociatedConstraint, 3> ExistingConstraints;
408408
Function->getAssociatedConstraints(ExistingConstraints);
409409
if (!ExistingConstraints.empty()) {
410410
// FIXME - Support adding new constraints to existing ones. Do we need to

clang-tools-extra/clangd/AST.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ getQualification(ASTContext &Context, const DeclContext *DestContext,
119119
// There can't be any more tag parents after hitting a namespace.
120120
assert(!ReachedNS);
121121
(void)ReachedNS;
122-
NNS = NestedNameSpecifier::Create(Context, nullptr, false,
123-
TD->getTypeForDecl());
122+
NNS = NestedNameSpecifier::Create(Context, nullptr, TD->getTypeForDecl());
124123
} else if (auto *NSD = llvm::dyn_cast<NamespaceDecl>(CurContext)) {
125124
ReachedNS = true;
126125
NNS = NestedNameSpecifier::Create(Context, nullptr, NSD);

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,6 @@ bool allowIndex(CodeCompletionContext &CC) {
14671467
return true;
14681468
case NestedNameSpecifier::Super:
14691469
case NestedNameSpecifier::TypeSpec:
1470-
case NestedNameSpecifier::TypeSpecWithTemplate:
14711470
// Unresolved inside a template.
14721471
case NestedNameSpecifier::Identifier:
14731472
return false;

clang-tools-extra/clangd/DumpAST.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ class DumpVisitor : public RecursiveASTVisitor<DumpVisitor> {
157157
NNS_KIND(Identifier);
158158
NNS_KIND(Namespace);
159159
NNS_KIND(TypeSpec);
160-
NNS_KIND(TypeSpecWithTemplate);
161160
NNS_KIND(Global);
162161
NNS_KIND(Super);
163162
NNS_KIND(NamespaceAlias);

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ struct TargetFinder {
500500
}
501501
return;
502502
case NestedNameSpecifier::TypeSpec:
503-
case NestedNameSpecifier::TypeSpecWithTemplate:
504503
add(QualType(NNS->getAsType(), 0), Flags);
505504
return;
506505
case NestedNameSpecifier::Global:

clang-tools-extra/include-cleaner/lib/WalkAST.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
144144
case NestedNameSpecifier::Global:
145145
return true;
146146
case NestedNameSpecifier::TypeSpec:
147-
case NestedNameSpecifier::TypeSpecWithTemplate:
148147
case NestedNameSpecifier::Super:
149148
case NestedNameSpecifier::Identifier:
150149
return false;

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ Improvements to Clang's diagnostics
275275
- Diagnostics on chained comparisons (``a < b < c``) are now an error by default. This can be disabled with
276276
``-Wno-error=parentheses``.
277277
- Clang now better preserves the sugared types of pointers to member.
278+
- Clang now better preserves the presence of the template keyword with dependent
279+
prefixes.
280+
- When printing types for diagnostics, clang now doesn't suppress the scopes of
281+
template arguments contained within nested names.
278282
- The ``-Wshift-bool`` warning has been added to warn about shifting a boolean. (#GH28334)
279283
- Fixed diagnostics adding a trailing ``::`` when printing some source code
280284
constructs, like base classes.
@@ -366,6 +370,9 @@ Bug Fixes to C++ Support
366370
- Clang now uses the parameter location for abbreviated function templates in ``extern "C"``. (#GH46386)
367371
- Clang will emit an error instead of crash when use co_await or co_yield in
368372
C++26 braced-init-list template parameter initialization. (#GH78426)
373+
- Improved fix for an issue with pack expansions of type constraints, where this
374+
now also works if the constraint has non-type or template template parameters.
375+
(#GH131798)
369376
- Fixes matching of nested template template parameters. (#GH130362)
370377
- Correctly diagnoses template template paramters which have a pack parameter
371378
not in the last position.

clang/include/clang/AST/ASTConcept.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,15 @@ class TypeConstraint {
229229
/// type-constraint.
230230
Expr *ImmediatelyDeclaredConstraint = nullptr;
231231
ConceptReference *ConceptRef;
232+
int ArgumentPackSubstitutionIndex;
232233

233234
public:
234235
TypeConstraint(ConceptReference *ConceptRef,
235-
Expr *ImmediatelyDeclaredConstraint)
236+
Expr *ImmediatelyDeclaredConstraint,
237+
int ArgumentPackSubstitutionIndex)
236238
: ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint),
237-
ConceptRef(ConceptRef) {}
239+
ConceptRef(ConceptRef),
240+
ArgumentPackSubstitutionIndex(ArgumentPackSubstitutionIndex) {}
238241

239242
/// \brief Get the immediately-declared constraint expression introduced by
240243
/// this type-constraint, that is - the constraint expression that is added to
@@ -245,6 +248,10 @@ class TypeConstraint {
245248

246249
ConceptReference *getConceptReference() const { return ConceptRef; }
247250

251+
int getArgumentPackSubstitutionIndex() const {
252+
return ArgumentPackSubstitutionIndex;
253+
}
254+
248255
// FIXME: Instead of using these concept related functions the callers should
249256
// directly work with the corresponding ConceptReference.
250257
ConceptDecl *getNamedConcept() const { return ConceptRef->getNamedConcept(); }

0 commit comments

Comments
 (0)