Skip to content

Commit bc68d7f

Browse files
authored
Merge branch 'main' into wip-fmv-feature-deps
2 parents 20e0dd2 + 144bdf3 commit bc68d7f

File tree

728 files changed

+127575
-135954
lines changed

Some content is hidden

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

728 files changed

+127575
-135954
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
/clang/tools/clang-installapi/ @cyndyishida
142142

143143
# ExtractAPI
144-
/clang/**/ExtractAPI @daniel-grumberg
144+
/clang/**/ExtractAPI @daniel-grumberg @QuietMisdreavus
145145

146146
# DWARFLinker, dwarfutil, dsymutil
147147
/llvm/**/DWARFLinker/ @JDevlieghere

clang/docs/LanguageExtensions.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5974,3 +5974,31 @@ Clang guarantees the following behaviors:
59745974
padding bits are initialized to zero.
59755975
59765976
Currently, the above extension only applies to C source code, not C++.
5977+
5978+
5979+
Empty Objects in C
5980+
==================
5981+
The declaration of a structure or union type which has no named members is
5982+
undefined behavior (C23 and earlier) or implementation-defined behavior (C2y).
5983+
Clang allows the declaration of a structure or union type with no named members
5984+
in all C language modes. `sizeof` for such a type returns `0`, which is
5985+
different behavior than in C++ (where the size of such an object is typically
5986+
`1`).
5987+
5988+
5989+
Qualified function types in C
5990+
=============================
5991+
Declaring a function with a qualified type in C is undefined behavior (C23 and
5992+
earlier) or implementation-defined behavior (C2y). Clang allows a function type
5993+
to be specified with the ``const`` and ``volatile`` qualifiers, but ignores the
5994+
qualifications.
5995+
5996+
.. code-block:: c
5997+
5998+
typedef int f(void);
5999+
const volatile f func; // Qualifier on function type has no effect.
6000+
6001+
6002+
Note, Clang does not allow an ``_Atomic`` function type because
6003+
of explicit constraints against atomically qualified (arrays and) function
6004+
types.

clang/docs/ReleaseNotes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,22 @@ C2y Feature Support
298298
paper adopts Clang's existing practice, so there were no changes to compiler
299299
behavior.
300300

301+
- Implemented support for `N3341 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3341.pdf>`_
302+
which makes empty structure and union objects implementation-defined in C.
303+
``-Wgnu-empty-struct`` will be emitted in C23 and earlier modes because the
304+
behavior is a conforming GNU extension in those modes, but will no longer
305+
have an effect in C2y mode.
306+
307+
- Updated conformance for `N3342 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3342.pdf>`_
308+
which made qualified function types implementation-defined rather than
309+
undefined. Clang has always accepted ``const`` and ``volatile`` qualified
310+
function types by ignoring the qualifiers.
311+
312+
- Updated conformance for `N3346 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3346.pdf>`_
313+
which changes some undefined behavior around initialization to instead be
314+
constraint violations. This paper adopts Clang's existing practice, so there
315+
were no changes to compiler behavior.
316+
301317
C23 Feature Support
302318
^^^^^^^^^^^^^^^^^^^
303319

clang/include/clang/AST/StmtOpenACC.h

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ class OpenACCAssociatedStmtConstruct : public OpenACCConstructStmt {
114114
}
115115
};
116116

117-
class OpenACCLoopConstruct;
118117
/// This class represents a compute construct, representing a 'Kind' of
119118
/// `parallel', 'serial', or 'kernel'. These constructs are associated with a
120119
/// 'structured block', defined as:
@@ -183,8 +182,7 @@ class OpenACCComputeConstruct final
183182
static OpenACCComputeConstruct *
184183
Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc,
185184
SourceLocation DirectiveLoc, SourceLocation EndLoc,
186-
ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock,
187-
ArrayRef<OpenACCLoopConstruct *> AssociatedLoopConstructs);
185+
ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock);
188186

189187
Stmt *getStructuredBlock() { return getAssociatedStmt(); }
190188
const Stmt *getStructuredBlock() const {
@@ -198,12 +196,10 @@ class OpenACCLoopConstruct final
198196
: public OpenACCAssociatedStmtConstruct,
199197
public llvm::TrailingObjects<OpenACCLoopConstruct,
200198
const OpenACCClause *> {
201-
// The compute construct this loop is associated with, or nullptr if this is
202-
// an orphaned loop construct, or if it hasn't been set yet. Because we
203-
// construct the directives at the end of their statement, the 'parent'
204-
// construct is not yet available at the time of construction, so this needs
205-
// to be set 'later'.
206-
const OpenACCComputeConstruct *ParentComputeConstruct = nullptr;
199+
// The compute/combined construct kind this loop is associated with, or
200+
// invalid if this is an orphaned loop construct.
201+
OpenACCDirectiveKind ParentComputeConstructKind =
202+
OpenACCDirectiveKind::Invalid;
207203

208204
friend class ASTStmtWriter;
209205
friend class ASTStmtReader;
@@ -212,15 +208,9 @@ class OpenACCLoopConstruct final
212208

213209
OpenACCLoopConstruct(unsigned NumClauses);
214210

215-
OpenACCLoopConstruct(SourceLocation Start, SourceLocation DirLoc,
216-
SourceLocation End,
211+
OpenACCLoopConstruct(OpenACCDirectiveKind ParentKind, SourceLocation Start,
212+
SourceLocation DirLoc, SourceLocation End,
217213
ArrayRef<const OpenACCClause *> Clauses, Stmt *Loop);
218-
void setLoop(Stmt *Loop);
219-
220-
void setParentComputeConstruct(OpenACCComputeConstruct *CC) {
221-
assert(!ParentComputeConstruct && "Parent already set?");
222-
ParentComputeConstruct = CC;
223-
}
224214

225215
public:
226216
static bool classof(const Stmt *T) {
@@ -231,9 +221,9 @@ class OpenACCLoopConstruct final
231221
unsigned NumClauses);
232222

233223
static OpenACCLoopConstruct *
234-
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation DirLoc,
235-
SourceLocation EndLoc, ArrayRef<const OpenACCClause *> Clauses,
236-
Stmt *Loop);
224+
Create(const ASTContext &C, OpenACCDirectiveKind ParentKind,
225+
SourceLocation BeginLoc, SourceLocation DirLoc, SourceLocation EndLoc,
226+
ArrayRef<const OpenACCClause *> Clauses, Stmt *Loop);
237227

238228
Stmt *getLoop() { return getAssociatedStmt(); }
239229
const Stmt *getLoop() const {
@@ -246,10 +236,11 @@ class OpenACCLoopConstruct final
246236
/// loop construct is the nearest compute construct that lexically contains
247237
/// the loop construct.
248238
bool isOrphanedLoopConstruct() const {
249-
return ParentComputeConstruct == nullptr;
239+
return ParentComputeConstructKind == OpenACCDirectiveKind::Invalid;
250240
}
251-
const OpenACCComputeConstruct *getParentComputeConstruct() const {
252-
return ParentComputeConstruct;
241+
242+
OpenACCDirectiveKind getParentComputeConstructKind() const {
243+
return ParentComputeConstructKind;
253244
}
254245
};
255246
} // namespace clang

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6241,8 +6241,9 @@ def err_typecheck_negative_array_size : Error<"array size is negative">;
62416241
def warn_typecheck_function_qualifiers_ignored : Warning<
62426242
"'%0' qualifier on function type %1 has no effect">,
62436243
InGroup<IgnoredQualifiers>;
6244-
def warn_typecheck_function_qualifiers_unspecified : Warning<
6245-
"'%0' qualifier on function type %1 has unspecified behavior">;
6244+
def ext_typecheck_function_qualifiers_unspecified : ExtWarn<
6245+
"'%0' qualifier on function type %1 has no effect and is a Clang extension">,
6246+
InGroup<IgnoredQualifiers>;
62466247
def warn_typecheck_reference_qualifiers : Warning<
62476248
"'%0' qualifier on reference type %1 has no effect">,
62486249
InGroup<IgnoredReferenceQualifiers>;

clang/include/clang/Basic/arm_sve.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ let SVETargetGuard = "sve2,lut,bf16", SMETargetGuard = "sme2,lut,bf16" in {
19621962
////////////////////////////////////////////////////////////////////////////////
19631963
// SVE2 - Optional
19641964

1965-
let SVETargetGuard = "sve2,sve-aes", SMETargetGuard = InvalidMode in {
1965+
let SVETargetGuard = "sve2-aes", SMETargetGuard = InvalidMode in {
19661966
def SVAESD : SInst<"svaesd[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aesd", [IsOverloadNone]>;
19671967
def SVAESIMC : SInst<"svaesimc[_{d}]", "dd", "Uc", MergeNone, "aarch64_sve_aesimc", [IsOverloadNone]>;
19681968
def SVAESE : SInst<"svaese[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aese", [IsOverloadNone]>;

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
namespace clang {
2626
class DeclGroupRef;
2727
class DiagnosticsEngine;
28+
namespace CIRGen {
29+
class CIRGenModule;
30+
} // namespace CIRGen
2831
} // namespace clang
2932

3033
namespace mlir {
3134
class MLIRContext;
3235
} // namespace mlir
3336
namespace cir {
34-
class CIRGenModule;
35-
3637
class CIRGenerator : public clang::ASTConsumer {
3738
virtual void anchor();
3839
clang::DiagnosticsEngine &diags;
@@ -44,7 +45,7 @@ class CIRGenerator : public clang::ASTConsumer {
4445

4546
protected:
4647
std::unique_ptr<mlir::MLIRContext> mlirCtx;
47-
std::unique_ptr<CIRGenModule> cgm;
48+
std::unique_ptr<clang::CIRGen::CIRGenModule> cgm;
4849

4950
public:
5051
CIRGenerator(clang::DiagnosticsEngine &diags,

clang/include/clang/CIR/Dialect/IR/CIRDialect.td

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def CIR_Dialect : Dialect {
2222
let summary = "A high-level dialect for analyzing and optimizing Clang "
2323
"supported languages";
2424

25-
let cppNamespace = "::mlir::cir";
25+
let cppNamespace = "::cir";
2626

2727
let useDefaultAttributePrinterParser = 0;
2828
let useDefaultTypePrinterParser = 0;
@@ -31,13 +31,15 @@ def CIR_Dialect : Dialect {
3131
void registerAttributes();
3232
void registerTypes();
3333

34-
Type parseType(DialectAsmParser &parser) const override;
35-
void printType(Type type, DialectAsmPrinter &printer) const override;
34+
mlir::Type parseType(mlir::DialectAsmParser &parser) const override;
35+
void printType(mlir::Type type,
36+
mlir::DialectAsmPrinter &printer) const override;
3637

37-
Attribute parseAttribute(DialectAsmParser &parser,
38-
Type type) const override;
38+
mlir::Attribute parseAttribute(mlir::DialectAsmParser &parser,
39+
mlir::Type type) const override;
3940

40-
void printAttribute(Attribute attr, DialectAsmPrinter &os) const override;
41+
void printAttribute(mlir::Attribute attr,
42+
mlir::DialectAsmPrinter &os) const override;
4143
}];
4244
}
4345

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
5151
// following:
5252
//
5353
// class CIRFooOpLowering
54-
// : public mlir::OpConversionPattern<mlir::cir::FooOp> {
54+
// : public mlir::OpConversionPattern<cir::FooOp> {
5555
// public:
56-
// using OpConversionPattern<mlir::cir::FooOp>::OpConversionPattern;
56+
// using OpConversionPattern<cir::FooOp>::OpConversionPattern;
5757
//
5858
// mlir::LogicalResult matchAndRewrite(
59-
// mlir::cir::FooOp op,
59+
// cir::FooOp op,
6060
// OpAdaptor adaptor,
6161
// mlir::ConversionPatternRewriter &rewriter) const override {
6262
// rewriter.replaceOpWithNewOp<mlir::LLVM::BarOp>(
@@ -92,7 +92,7 @@ def FuncOp : CIR_Op<"func"> {
9292

9393
let skipDefaultBuilders = 1;
9494

95-
let builders = [OpBuilder<(ins "StringRef":$name)>];
95+
let builders = [OpBuilder<(ins "llvm::StringRef":$name)>];
9696

9797
let hasCustomAssemblyFormat = 1;
9898
let hasVerifier = 1;

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ class OpenACCClause;
3434

3535
class SemaOpenACC : public SemaBase {
3636
private:
37-
/// A collection of loop constructs in the compute construct scope that
38-
/// haven't had their 'parent' compute construct set yet. Entires will only be
39-
/// made to this list in the case where we know the loop isn't an orphan.
40-
llvm::SmallVector<OpenACCLoopConstruct *> ParentlessLoopConstructs;
41-
4237
struct ComputeConstructInfo {
4338
/// Which type of compute construct we are inside of, which we can use to
4439
/// determine whether we should add loops to the above collection. We can
@@ -768,7 +763,6 @@ class SemaOpenACC : public SemaBase {
768763
SourceLocation OldLoopWorkerClauseLoc;
769764
SourceLocation OldLoopVectorClauseLoc;
770765
SourceLocation OldLoopWithoutSeqLoc;
771-
llvm::SmallVector<OpenACCLoopConstruct *> ParentlessLoopConstructs;
772766
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
773767
LoopInConstructRAII LoopRAII;
774768

0 commit comments

Comments
 (0)