Skip to content

Commit 328556a

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-remove-region-before-cg-tmp
2 parents f5c28ee + c8ee116 commit 328556a

File tree

584 files changed

+11790
-5985
lines changed

Some content is hidden

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

584 files changed

+11790
-5985
lines changed

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && \
5757
nodejs \
5858
perl-modules \
5959
python3-psutil \
60+
sudo \
6061

6162
# These are needed by the premerge pipeline. Pip is used to install
6263
# dependent python packages and ccache is used for build caching. File and
@@ -66,12 +67,28 @@ RUN apt-get update && \
6667
file \
6768
tzdata
6869

70+
# Install sccache as it is needed by most of the project test workflows and
71+
# cannot be installed by the ccache action when executing as a non-root user.
72+
# TODO(boomanaiden154): This should be switched to being installed with apt
73+
# once we bump to Ubuntu 24.04.
74+
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.7.6/sccache-v0.7.6-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
75+
echo "2902a5e44c3342132f07b62e70cca75d9b23252922faf3b924f449808cc1ae58 /tmp/sccache.tar.gz" | sha256sum -c && \
76+
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
77+
rm /tmp/sccache.tar.gz && \
78+
chmod +x /usr/local/bin/sccache
79+
6980
ENV LLVM_SYSROOT=$LLVM_SYSROOT
7081
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
7182

7283
# Create a new user to avoid test failures related to a lack of expected
7384
# permissions issues in some tests. Set the user id to 1001 as that is the
7485
# user id that Github Actions uses to perform the checkout action.
7586
RUN useradd gha -u 1001 -m -s /bin/bash
87+
88+
# Also add the user to passwordless sudoers so that we can install software
89+
# later on without having to rebuild the container.
90+
RUN adduser gha sudo
91+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
92+
7693
USER gha
7794

.github/workflows/premerge.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Setup ccache
3232
uses: hendrikmuhs/[email protected]
3333
- name: Build and Test
34+
# Mark the job as a success even if the step fails so that people do
35+
# not get notified while the new premerge pipeline is in an
36+
# experimental state.
37+
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
38+
# are ready for people to start recieving notifications.
39+
continue-on-error: true
3440
run: |
3541
git config --global --add safe.directory '*'
3642

clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AST_MATCHER(FieldDecl, hasIntBitwidth) {
3838
assert(Node.isBitField());
3939
const ASTContext &Ctx = Node.getASTContext();
4040
unsigned IntBitWidth = Ctx.getIntWidth(Ctx.IntTy);
41-
unsigned CurrentBitWidth = Node.getBitWidthValue();
41+
unsigned CurrentBitWidth = Node.getBitWidthValue(Ctx);
4242
return IntBitWidth == CurrentBitWidth;
4343
}
4444

clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static MagnitudeBits calcMagnitudeBits(const ASTContext &Context,
124124
unsigned SignedBits = IntExprType->isUnsignedIntegerType() ? 0U : 1U;
125125

126126
if (const auto *BitField = IntExpr->getSourceBitField()) {
127-
unsigned BitFieldWidth = BitField->getBitWidthValue();
127+
unsigned BitFieldWidth = BitField->getBitWidthValue(Context);
128128
return {BitFieldWidth - SignedBits, BitFieldWidth};
129129
}
130130

clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void MultiwayPathsCoveredCheck::handleSwitchWithoutDefault(
160160
}
161161
if (const auto *BitfieldDecl =
162162
Result.Nodes.getNodeAs<FieldDecl>("bitfield")) {
163-
return twoPow(BitfieldDecl->getBitWidthValue());
163+
return twoPow(BitfieldDecl->getBitWidthValue(*Result.Context));
164164
}
165165

166166
return static_cast<std::size_t>(0);

clang-tools-extra/clangd/Hover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ void addLayoutInfo(const NamedDecl &ND, HoverInfo &HI) {
10181018
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(Record);
10191019
HI.Offset = Layout.getFieldOffset(FD->getFieldIndex());
10201020
if (FD->isBitField())
1021-
HI.Size = FD->getBitWidthValue();
1021+
HI.Size = FD->getBitWidthValue(Ctx);
10221022
else if (auto Size = Ctx.getTypeSizeInCharsIfKnown(FD->getType()))
10231023
HI.Size = FD->isZeroSize(Ctx) ? 0 : Size->getQuantity() * 8;
10241024
if (HI.Size) {

clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ TEST_F(LSPTest, ClangTidyRename) {
208208
Annotations Source(R"cpp(
209209
void [[foo]]() {}
210210
)cpp");
211-
Opts.ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
212-
llvm::StringRef) {
211+
constexpr auto ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
212+
llvm::StringRef) {
213213
ClangTidyOpts.Checks = {"-*,readability-identifier-naming"};
214214
ClangTidyOpts.CheckOptions["readability-identifier-naming.FunctionCase"] =
215215
"CamelCase";
216216
};
217+
Opts.ClangTidyProvider = ClangTidyProvider;
217218
auto &Client = start();
218219
Client.didOpen("foo.hpp", Header.code());
219220
Client.didOpen("foo.cpp", Source.code());
@@ -266,10 +267,11 @@ TEST_F(LSPTest, ClangTidyCrash_Issue109367) {
266267
// This test requires clang-tidy checks to be linked in.
267268
if (!CLANGD_TIDY_CHECKS)
268269
return;
269-
Opts.ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
270-
llvm::StringRef) {
270+
constexpr auto ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
271+
llvm::StringRef) {
271272
ClangTidyOpts.Checks = {"-*,boost-use-ranges"};
272273
};
274+
Opts.ClangTidyProvider = ClangTidyProvider;
273275
// Check that registering the boost-use-ranges checker's matchers
274276
// on two different threads does not cause a crash.
275277
auto &Client = start();

clang/docs/LibASTMatchersReference.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,6 +3462,21 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
34623462
</pre></td></tr>
34633463

34643464

3465+
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DependentNameType.html">DependentNameType</a>&gt;</td><td class="name" onclick="toggle('hasDependentName1')"><a name="hasDependentName1Anchor">hasDependentName</a></td><td>std::string N</td></tr>
3466+
<tr><td colspan="4" class="doc" id="hasDependentName1"><pre>Matches the dependent name of a DependentNameType.
3467+
3468+
Matches the dependent name of a DependentNameType
3469+
3470+
Given:
3471+
3472+
template &lt;typename T&lt; struct declToImport {
3473+
typedef typename T::type dependent_name;
3474+
};
3475+
3476+
dependentNameType(hasDependentName("type")) matches `T::type`
3477+
</pre></td></tr>
3478+
3479+
34653480
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('memberHasSameNameAsBoundNode0')"><a name="memberHasSameNameAsBoundNode0Anchor">memberHasSameNameAsBoundNode</a></td><td>std::string BindingID</td></tr>
34663481
<tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
34673482
node

clang/docs/OpenMPSupport.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ implementation.
320320
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
321321
| misc | nothing directive | :good:`done` | D123286 |
322322
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
323-
| misc | masked construct and related combined constructs | :part:`worked on` | D99995, D100514 |
323+
| misc | masked construct and related combined constructs | :good:`done` | D99995, D100514, PR-121741(parallel_masked_taskloop) |
324+
| | | | PR-121746(parallel_masked_task_loop_simd),PR-121914(masked_taskloop) |
325+
| | | | PR-121916(masked_taskloop_simd) |
324326
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
325327
| misc | default(firstprivate) & default(private) | :good:`done` | D75591 (firstprivate), D125912 (private) |
326328
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ AST Matchers
11301130

11311131
- Add ``dependentTemplateSpecializationType`` matcher to match a dependent template specialization type.
11321132

1133-
- Add ``hasDependentName`` matcher to match the dependent name of a DependentScopeDeclRefExpr.
1133+
- Add ``hasDependentName`` matcher to match the dependent name of a DependentScopeDeclRefExpr or DependentNameType.
11341134

11351135
clang-format
11361136
------------
@@ -1283,6 +1283,12 @@ Sanitizers
12831283
by the compiler (for example,
12841284
``-fno-sanitize-merge=bool,enum,array-bounds,local-bounds``).
12851285

1286+
- Changed ``-fsanitize=pointer-overflow`` to no longer report ``NULL + 0`` as
1287+
undefined behavior in C, in line with
1288+
`N3322 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>`_,
1289+
and matching the previous behavior for C++.
1290+
``NULL + non_zero`` continues to be reported as undefined behavior.
1291+
12861292
Python Binding Changes
12871293
----------------------
12881294
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.
@@ -1297,6 +1303,8 @@ OpenMP Support
12971303
- Changed the OpenMP DeviceRTL to use 'generic' IR. The
12981304
``LIBOMPTARGET_DEVICE_ARCHITECTURES`` CMake argument is now unused and will
12991305
always build support for AMDGPU and NVPTX targets.
1306+
- Added support for combined masked constructs 'omp parallel masked taskloop',
1307+
'omp parallel masked taskloop simd','omp masked taskloop' and 'omp masked taskloop simd' directive.
13001308

13011309
Improvements
13021310
^^^^^^^^^^^^

clang/docs/UndefinedBehaviorSanitizer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Available checks are:
177177
problems at higher optimization levels.
178178
- ``-fsanitize=pointer-overflow``: Performing pointer arithmetic which
179179
overflows, or where either the old or new pointer value is a null pointer
180-
(or in C, when they both are).
180+
(excluding the case where both are null pointers).
181181
- ``-fsanitize=return``: In C++, reaching the end of a
182182
value-returning function without returning a value.
183183
- ``-fsanitize=returns-nonnull-attribute``: Returning null pointer

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,9 +3142,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
31423142

31433143
/// Computes the bit width of this field, if this is a bit field.
31443144
/// May not be called on non-bitfields.
3145-
/// Note that in order to successfully use this function, the bitwidth
3146-
/// expression must be a ConstantExpr with a valid integer result set.
3147-
unsigned getBitWidthValue() const;
3145+
unsigned getBitWidthValue(const ASTContext &Ctx) const;
31483146

31493147
/// Set the bit-field width for this member.
31503148
// Note: used by some clients (i.e., do not remove it).
@@ -3175,7 +3173,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
31753173
/// Is this a zero-length bit-field? Such bit-fields aren't really bit-fields
31763174
/// at all and instead act as a separator between contiguous runs of other
31773175
/// bit-fields.
3178-
bool isZeroLengthBitField() const;
3176+
bool isZeroLengthBitField(const ASTContext &Ctx) const;
31793177

31803178
/// Determine if this field is a subobject of zero size, that is, either a
31813179
/// zero-length bit-field or a field of empty class type with the

clang/include/clang/AST/OpenACCClause.h

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,18 +327,89 @@ class OpenACCIfClause : public OpenACCClauseWithCondition {
327327
SourceLocation EndLoc);
328328
};
329329

330-
/// A 'self' clause, which has an optional condition expression.
331-
class OpenACCSelfClause : public OpenACCClauseWithCondition {
330+
/// A 'self' clause, which has an optional condition expression, or, in the
331+
/// event of an 'update' directive, contains a 'VarList'.
332+
class OpenACCSelfClause final
333+
: public OpenACCClauseWithParams,
334+
private llvm::TrailingObjects<OpenACCSelfClause, Expr *> {
335+
friend TrailingObjects;
336+
// Holds whether this HAS a condition expression. Lacks a value if this is NOT
337+
// a condition-expr self clause.
338+
std::optional<bool> HasConditionExpr;
339+
// Holds the number of stored expressions. In the case of a condition-expr
340+
// self clause, this is expected to be ONE (and there to be 1 trailing
341+
// object), whether or not that is null.
342+
unsigned NumExprs;
343+
332344
OpenACCSelfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
333345
Expr *ConditionExpr, SourceLocation EndLoc);
346+
OpenACCSelfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
347+
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
348+
349+
// Intentionally internal, meant to be an implementation detail of everything
350+
// else. All non-internal uses should go through getConditionExpr/getVarList.
351+
llvm::ArrayRef<Expr *> getExprs() const {
352+
return {getTrailingObjects<Expr *>(), NumExprs};
353+
}
334354

335355
public:
336356
static bool classof(const OpenACCClause *C) {
337357
return C->getClauseKind() == OpenACCClauseKind::Self;
338358
}
359+
360+
bool isConditionExprClause() const { return HasConditionExpr.has_value(); }
361+
362+
bool hasConditionExpr() const {
363+
assert(HasConditionExpr.has_value() &&
364+
"VarList Self Clause asked about condition expression");
365+
return *HasConditionExpr;
366+
}
367+
368+
const Expr *getConditionExpr() const {
369+
assert(HasConditionExpr.has_value() &&
370+
"VarList Self Clause asked about condition expression");
371+
assert(getExprs().size() == 1 &&
372+
"ConditionExpr Self Clause with too many Exprs");
373+
return getExprs()[0];
374+
}
375+
376+
Expr *getConditionExpr() {
377+
assert(HasConditionExpr.has_value() &&
378+
"VarList Self Clause asked about condition expression");
379+
assert(getExprs().size() == 1 &&
380+
"ConditionExpr Self Clause with too many Exprs");
381+
return getExprs()[0];
382+
}
383+
384+
ArrayRef<Expr *> getVarList() {
385+
assert(!HasConditionExpr.has_value() &&
386+
"Condition Expr self clause asked about var list");
387+
return getExprs();
388+
}
389+
ArrayRef<Expr *> getVarList() const {
390+
assert(!HasConditionExpr.has_value() &&
391+
"Condition Expr self clause asked about var list");
392+
return getExprs();
393+
}
394+
395+
child_range children() {
396+
return child_range(
397+
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>()),
398+
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>() + NumExprs));
399+
}
400+
401+
const_child_range children() const {
402+
child_range Children = const_cast<OpenACCSelfClause *>(this)->children();
403+
return const_child_range(Children.begin(), Children.end());
404+
}
405+
339406
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
340407
SourceLocation LParenLoc,
341408
Expr *ConditionExpr, SourceLocation EndLoc);
409+
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
410+
SourceLocation LParenLoc,
411+
ArrayRef<Expr *> ConditionExpr,
412+
SourceLocation EndLoc);
342413
};
343414

344415
/// Represents a clause that has one or more expressions associated with it.

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,8 @@ AST_MATCHER(FieldDecl, isBitField) {
708708
/// fieldDecl(hasBitWidth(2))
709709
/// matches 'int a;' and 'int c;' but not 'int b;'.
710710
AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width) {
711-
return Node.isBitField() && Node.getBitWidthValue() == Width;
711+
return Node.isBitField() &&
712+
Node.getBitWidthValue(Finder->getASTContext()) == Width;
712713
}
713714

714715
/// Matches non-static data members that have an in-class initializer.
@@ -3256,15 +3257,27 @@ AST_MATCHER_P(CXXDependentScopeMemberExpr, memberHasSameNameAsBoundNode,
32563257
});
32573258
}
32583259

3259-
/// Matches the dependent name of a DependentScopeDeclRefExpr
3260+
/// Matches the dependent name of a DependentScopeDeclRefExpr or
3261+
/// DependentNameType
32603262
///
32613263
/// Given:
32623264
/// \code
32633265
/// template <class T> class X : T { void f() { T::v; } };
32643266
/// \endcode
32653267
/// \c dependentScopeDeclRefExpr(hasDependentName("v")) matches `T::v`
3266-
AST_MATCHER_P(DependentScopeDeclRefExpr, hasDependentName, std::string, N) {
3267-
return Node.getDeclName().getAsString() == N;
3268+
///
3269+
/// Given:
3270+
/// \code
3271+
/// template <typename T> struct declToImport {
3272+
/// typedef typename T::type dependent_name;
3273+
/// };
3274+
/// \endcode
3275+
/// \c dependentNameType(hasDependentName("type")) matches `T::type`
3276+
AST_POLYMORPHIC_MATCHER_P(hasDependentName,
3277+
AST_POLYMORPHIC_SUPPORTED_TYPES(
3278+
DependentScopeDeclRefExpr, DependentNameType),
3279+
std::string, N) {
3280+
return internal::getDependentName(Node) == N;
32683281
}
32693282

32703283
/// Matches C++ classes that are directly or indirectly derived from a class
@@ -7723,7 +7736,7 @@ AST_MATCHER_P(DecayedType, hasDecayedType, internal::Matcher<QualType>,
77237736

77247737
/// Matches a dependent name type
77257738
///
7726-
/// Example matches T::type
7739+
/// Example matches T::type
77277740
/// \code
77287741
/// template <typename T> struct declToImport {
77297742
/// typedef typename T::type dependent_name;

clang/include/clang/ASTMatchers/ASTMatchersInternal.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,14 @@ MatchTemplateArgLocAt(const TemplateSpecializationTypeLoc &Node,
23432343
InnerMatcher.matches(Node.getArgLoc(Index), Finder, Builder);
23442344
}
23452345

2346+
inline std::string getDependentName(const DependentScopeDeclRefExpr &node) {
2347+
return node.getDeclName().getAsString();
2348+
}
2349+
2350+
inline std::string getDependentName(const DependentNameType &node) {
2351+
return node.getIdentifier()->getName().str();
2352+
}
2353+
23462354
} // namespace internal
23472355

23482356
} // namespace ast_matchers

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4335,16 +4335,6 @@ def HLSLLoopHint: StmtAttr {
43354335
let Documentation = [HLSLLoopHintDocs, HLSLUnrollHintDocs];
43364336
}
43374337

4338-
def HLSLControlFlowHint: StmtAttr {
4339-
/// [branch]
4340-
/// [flatten]
4341-
let Spellings = [Microsoft<"branch">, Microsoft<"flatten">];
4342-
let Subjects = SubjectList<[IfStmt],
4343-
ErrorDiag, "'if' statements">;
4344-
let LangOpts = [HLSL];
4345-
let Documentation = [InternalOnly];
4346-
}
4347-
43484338
def CapturedRecord : InheritableAttr {
43494339
// This attribute has no spellings as it is only ever created implicitly.
43504340
let Spellings = [];

0 commit comments

Comments
 (0)