Skip to content

Commit b15cab3

Browse files
authored
Merge branch 'main' into main
2 parents 657e5b5 + 4b67c53 commit b15cab3

File tree

563 files changed

+20218
-12213
lines changed

Some content is hidden

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

563 files changed

+20218
-12213
lines changed

.ci/monolithic-linux.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ targets="${2}"
5353
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5454

5555
echo "--- cmake"
56-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
57-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
58-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
56+
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
57+
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
58+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
5959
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6060
-D LLVM_ENABLE_PROJECTS="${projects}" \
6161
-G Ninja \

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/bindings/python/tests/cindex/test_diagnostics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_diagnostic_category(self):
7979
self.assertEqual(d.location.line, 1)
8080
self.assertEqual(d.location.column, 11)
8181

82-
self.assertEqual(d.category_number, 2)
82+
self.assertEqual(d.category_number, 3)
8383
self.assertEqual(d.category_name, "Semantic Issue")
8484

8585
def test_diagnostic_option(self):
@@ -123,7 +123,7 @@ def test_diagnostic_string_format(self):
123123
self.assertEqual(str(d), "t.c:1:26: error: expected ';' after struct")
124124
self.assertEqual(
125125
d.format(0b111111),
126-
"t.c:1:26: error: expected ';' after struct [3, Parse Issue]",
126+
"t.c:1:26: error: expected ';' after struct [2, Parse Issue]",
127127
)
128128
with self.assertRaises(ValueError):
129129
d.format(0b1000000)

clang/docs/ReleaseNotes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,15 @@ C23 Feature Support
159159
which clarified that a compound literal used within a function prototype is
160160
treated as if the compound literal were within the body rather than at file
161161
scope.
162+
- Fixed a bug where you could not cast a null pointer constant to type
163+
``nullptr_t``. Fixes #GH133644.
162164

163165
Non-comprehensive list of changes in this release
164166
-------------------------------------------------
165167

166168
- Support parsing the `cc` operand modifier and alias it to the `c` modifier (#GH127719).
167169
- Added `__builtin_elementwise_exp10`.
170+
- For AMDPGU targets, added `__builtin_v_cvt_off_f32_i4` that maps to the `v_cvt_off_f32_i4` instruction.
168171

169172
New Compiler Flags
170173
------------------
@@ -311,6 +314,8 @@ Improvements to Clang's diagnostics
311314
312315
Fixes #GH61635
313316

317+
- Split diagnosing base class qualifiers from the ``-Wignored-Qualifiers`` diagnostic group into a new ``-Wignored-base-class-qualifiers`` diagnostic group (which is grouped under ``-Wignored-qualifiers``). Fixes #GH131935.
318+
314319
Improvements to Clang's time-trace
315320
----------------------------------
316321

@@ -337,6 +342,9 @@ Bug Fixes in This Version
337342
- Fixed a problematic case with recursive deserialization within ``FinishedDeserializing()`` where
338343
``PassInterestingDeclsToConsumer()`` was called before the declarations were safe to be passed. (#GH129982)
339344
- Fixed a modules crash where an explicit Constructor was deserialized. (#GH132794)
345+
- Defining an integer literal suffix (e.g., ``LL``) before including
346+
``<stdint.h>`` in a freestanding build no longer causes invalid token pasting
347+
when using the ``INTn_C`` macros. (#GH85995)
340348

341349
Bug Fixes to Compiler Builtins
342350
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -370,6 +378,9 @@ Bug Fixes to C++ Support
370378
- Clang now uses the parameter location for abbreviated function templates in ``extern "C"``. (#GH46386)
371379
- Clang will emit an error instead of crash when use co_await or co_yield in
372380
C++26 braced-init-list template parameter initialization. (#GH78426)
381+
- Improved fix for an issue with pack expansions of type constraints, where this
382+
now also works if the constraint has non-type or template template parameters.
383+
(#GH131798)
373384
- Fixes matching of nested template template parameters. (#GH130362)
374385
- Correctly diagnoses template template paramters which have a pack parameter
375386
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(); }

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,9 +1798,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
17981798
QualType
17991799
getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl,
18001800
unsigned Index,
1801-
std::optional<unsigned> PackIndex,
1802-
SubstTemplateTypeParmTypeFlag Flag =
1803-
SubstTemplateTypeParmTypeFlag::None) const;
1801+
std::optional<unsigned> PackIndex) const;
18041802
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl,
18051803
unsigned Index, bool Final,
18061804
const TemplateArgument &ArgPack);

clang/include/clang/AST/Decl.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ class UnresolvedSetImpl;
7878
class VarTemplateDecl;
7979
enum class ImplicitParamKind;
8080

81+
// Holds a constraint expression along with a pack expansion index, if
82+
// expanded.
83+
struct AssociatedConstraint {
84+
const Expr *ConstraintExpr;
85+
int ArgumentPackSubstitutionIndex;
86+
87+
explicit AssociatedConstraint(const Expr *ConstraintExpr,
88+
int ArgumentPackSubstitutionIndex = -1)
89+
: ConstraintExpr(ConstraintExpr),
90+
ArgumentPackSubstitutionIndex(ArgumentPackSubstitutionIndex) {}
91+
};
92+
8193
/// The top declaration context.
8294
class TranslationUnitDecl : public Decl,
8395
public DeclContext,
@@ -2631,9 +2643,10 @@ class FunctionDecl : public DeclaratorDecl,
26312643
///
26322644
/// Use this instead of getTrailingRequiresClause for concepts APIs that
26332645
/// accept an ArrayRef of constraint expressions.
2634-
void getAssociatedConstraints(SmallVectorImpl<const Expr *> &AC) const {
2646+
void
2647+
getAssociatedConstraints(SmallVectorImpl<AssociatedConstraint> &AC) const {
26352648
if (auto *TRC = getTrailingRequiresClause())
2636-
AC.push_back(TRC);
2649+
AC.emplace_back(TRC);
26372650
}
26382651

26392652
/// Get the message that indicates why this function was deleted.

clang/include/clang/AST/DeclCXX.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,7 @@ class CXXDestructorDecl : public CXXMethodDecl {
28522852
// FIXME: Don't allocate storage for these except in the first declaration
28532853
// of a virtual destructor.
28542854
FunctionDecl *OperatorDelete = nullptr;
2855+
FunctionDecl *OperatorArrayDelete = nullptr;
28552856
Expr *OperatorDeleteThisArg = nullptr;
28562857

28572858
CXXDestructorDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
@@ -2877,11 +2878,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
28772878
static CXXDestructorDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
28782879

28792880
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg);
2881+
void setOperatorArrayDelete(FunctionDecl *OD, Expr *ThisArg);
28802882

28812883
const FunctionDecl *getOperatorDelete() const {
28822884
return getCanonicalDecl()->OperatorDelete;
28832885
}
28842886

2887+
const FunctionDecl *getArrayOperatorDelete() const {
2888+
return getCanonicalDecl()->OperatorArrayDelete;
2889+
}
2890+
28852891
Expr *getOperatorDeleteThisArg() const {
28862892
return getCanonicalDecl()->OperatorDeleteThisArg;
28872893
}

clang/include/clang/AST/DeclTemplate.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ class TemplateParameterList final
195195
///
196196
/// The constraints in the resulting list are to be treated as if in a
197197
/// conjunction ("and").
198-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const;
198+
void getAssociatedConstraints(
199+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const;
199200

200201
bool hasAssociatedConstraints() const;
201202

@@ -422,7 +423,8 @@ class TemplateDecl : public NamedDecl {
422423
/// including constraint-expressions derived from the requires-clause,
423424
/// trailing requires-clause (for functions and methods) and constrained
424425
/// template parameters.
425-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const;
426+
void getAssociatedConstraints(
427+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const;
426428

427429
bool hasAssociatedConstraints() const;
428430

@@ -1341,7 +1343,8 @@ class TemplateTypeParmDecl final : public TypeDecl,
13411343
}
13421344

13431345
void setTypeConstraint(ConceptReference *CR,
1344-
Expr *ImmediatelyDeclaredConstraint);
1346+
Expr *ImmediatelyDeclaredConstraint,
1347+
int ArgumentPackSubstitutionIndex);
13451348

13461349
/// Determine whether this template parameter has a type-constraint.
13471350
bool hasTypeConstraint() const {
@@ -1353,9 +1356,11 @@ class TemplateTypeParmDecl final : public TypeDecl,
13531356
///
13541357
/// Use this instead of getTypeConstraint for concepts APIs that
13551358
/// accept an ArrayRef of constraint expressions.
1356-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const {
1359+
void getAssociatedConstraints(
1360+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const {
13571361
if (HasTypeConstraint)
1358-
AC.push_back(getTypeConstraint()->getImmediatelyDeclaredConstraint());
1362+
AC.emplace_back(getTypeConstraint()->getImmediatelyDeclaredConstraint(),
1363+
getTypeConstraint()->getArgumentPackSubstitutionIndex());
13591364
}
13601365

13611366
SourceRange getSourceRange() const override LLVM_READONLY;
@@ -1574,9 +1579,10 @@ class NonTypeTemplateParmDecl final
15741579
///
15751580
/// Use this instead of getPlaceholderImmediatelyDeclaredConstraint for
15761581
/// concepts APIs that accept an ArrayRef of constraint expressions.
1577-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const {
1582+
void getAssociatedConstraints(
1583+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const {
15781584
if (Expr *E = getPlaceholderTypeConstraint())
1579-
AC.push_back(E);
1585+
AC.emplace_back(E);
15801586
}
15811587

15821588
// Implement isa/cast/dyncast/etc.
@@ -2169,7 +2175,8 @@ class ClassTemplatePartialSpecializationDecl
21692175
///
21702176
/// The constraints in the resulting list are to be treated as if in a
21712177
/// conjunction ("and").
2172-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const {
2178+
void getAssociatedConstraints(
2179+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const {
21732180
TemplateParams->getAssociatedConstraints(AC);
21742181
}
21752182

@@ -2943,7 +2950,8 @@ class VarTemplatePartialSpecializationDecl
29432950
///
29442951
/// The constraints in the resulting list are to be treated as if in a
29452952
/// conjunction ("and").
2946-
void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const {
2953+
void getAssociatedConstraints(
2954+
llvm::SmallVectorImpl<AssociatedConstraint> &AC) const {
29472955
TemplateParams->getAssociatedConstraints(AC);
29482956
}
29492957

clang/include/clang/AST/PropertiesBase.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def Selector : PropertyType;
137137
def SourceLocation : PropertyType;
138138
def StmtRef : RefPropertyType<"Stmt"> { let ConstWhenWriting = 1; }
139139
def ExprRef : SubclassPropertyType<"Expr", StmtRef>;
140-
def SubstTemplateTypeParmTypeFlag : EnumPropertyType;
141140
def TemplateArgument : PropertyType;
142141
def TemplateArgumentKind : EnumPropertyType<"TemplateArgument::ArgKind">;
143142
def TemplateName : DefaultValuePropertyType;

0 commit comments

Comments
 (0)