Skip to content

Commit 2ac328c

Browse files
authored
Merge branch 'main' into dag-match-bitlogic
2 parents a2c6ef8 + fd80048 commit 2ac328c

File tree

552 files changed

+6906
-19345
lines changed

Some content is hidden

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

552 files changed

+6906
-19345
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ Language Selection and Mode Options
155155
156156
ISO C 2023 with GNU extensions
157157

158+
| ``c2y``
159+
160+
ISO C 202y
161+
162+
| ``gnu2y``
163+
164+
ISO C 202y with GNU extensions
165+
158166
The default C language standard is ``gnu17``, except on PS4, where it is
159167
``gnu99``.
160168

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ Non-comprehensive list of changes in this release
287287
stack space when running on Apple AArch64 based platforms. This means that
288288
stack traces of Clang from debuggers, crashes, and profilers may look
289289
different than before.
290+
- Fixed a crash when a VLA with an invalid size expression was used within a
291+
``sizeof`` or ``typeof`` expression. (#GH138444)
290292

291293
New Compiler Flags
292294
------------------
@@ -592,6 +594,9 @@ Bug Fixes to Attribute Support
592594
``__attribute__((unused))`` are still ignored after the definition, though
593595
this behavior may be relaxed in the future). (#GH135481)
594596

597+
- Clang will warn if a complete type specializes a deprecated partial specialization.
598+
(#GH44496)
599+
595600
Bug Fixes to C++ Support
596601
^^^^^^^^^^^^^^^^^^^^^^^^
597602

@@ -649,6 +654,7 @@ Bug Fixes to C++ Support
649654
(#GH136432), (#GH137014), (#GH138018)
650655
- Fixed an assertion when trying to constant-fold various builtins when the argument
651656
referred to a reference to an incomplete type. (#GH129397)
657+
- Fixed a crash when a cast involved a parenthesized aggregate initialization in dependent context. (#GH72880)
652658

653659
Bug Fixes to AST Handling
654660
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ExprCXX.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5124,8 +5124,8 @@ class CXXParenListInitExpr final
51245124

51255125
void updateDependence() { setDependence(computeDependence(this)); }
51265126

5127-
ArrayRef<Expr *> getInitExprs() {
5128-
return ArrayRef(getTrailingObjects<Expr *>(), NumExprs);
5127+
MutableArrayRef<Expr *> getInitExprs() {
5128+
return MutableArrayRef(getTrailingObjects<Expr *>(), NumExprs);
51295129
}
51305130

51315131
const ArrayRef<Expr *> getInitExprs() const {

clang/include/clang/Basic/BuiltinsRISCVXCV.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ let Attributes = [NoThrow, Const] in {
2121
//===----------------------------------------------------------------------===//
2222
// XCValu extension.
2323
//===----------------------------------------------------------------------===//
24-
def alu_slet : RISCVXCVBuiltin<"int(int, int)", "xcvalu">;
25-
def alu_sletu : RISCVXCVBuiltin<"int(unsigned int, unsigned int)", "xcvalu">;
24+
def alu_sle : RISCVXCVBuiltin<"int(int, int)", "xcvalu">;
25+
def alu_sleu : RISCVXCVBuiltin<"int(unsigned int, unsigned int)", "xcvalu">;
2626
def alu_exths : RISCVXCVBuiltin<"int(int)", "xcvalu">;
2727
def alu_exthz : RISCVXCVBuiltin<"unsigned int(unsigned int)", "xcvalu">;
2828
def alu_extbs : RISCVXCVBuiltin<"int(int)", "xcvalu">;

clang/include/clang/Basic/LangStandards.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ LANGSTANDARD(c2y, "c2y",
105105
LANGSTANDARD(gnu2y, "gnu2y",
106106
C, "Working Draft for ISO C2y with GNU extensions",
107107
LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | GNUMode | HexFloat)
108-
108+
// TODO: Add the iso9899:202y alias once ISO publishes the standard.
109109

110110
// C++ modes
111111
LANGSTANDARD(cxx98, "c++98",

clang/include/clang/Sema/Sema.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,9 +2388,14 @@ class Sema final : public SemaBase {
23882388
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
23892389
const ObjCInterfaceDecl *UnknownObjCClass,
23902390
bool ObjCPropertyAccess,
2391-
bool AvoidPartialAvailabilityChecks = false,
2392-
ObjCInterfaceDecl *ClassReceiver = nullptr);
2391+
bool AvoidPartialAvailabilityChecks,
2392+
ObjCInterfaceDecl *ClassReceiver);
23932393

2394+
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs);
2395+
2396+
std::pair<AvailabilityResult, const NamedDecl *>
2397+
ShouldDiagnoseAvailabilityOfDecl(const NamedDecl *D, std::string *Message,
2398+
ObjCInterfaceDecl *ClassReceiver);
23942399
///@}
23952400

23962401
//
@@ -6471,6 +6476,8 @@ class Sema final : public SemaBase {
64716476
void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
64726477
QualType ResultTy,
64736478
ArrayRef<QualType> Args);
6479+
// Helper for ActOnFields to check for all function pointer members.
6480+
bool EntirelyFunctionPointers(const RecordDecl *Record);
64746481

64756482
// A cache representing if we've fully checked the various comparison category
64766483
// types stored in ASTContext. The bit-index corresponds to the integer value
@@ -7167,6 +7174,11 @@ class Sema final : public SemaBase {
71677174
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E);
71687175
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R,
71697176
MultiExprArg Val);
7177+
ExprResult ActOnCXXParenListInitExpr(ArrayRef<Expr *> Args, QualType T,
7178+
unsigned NumUserSpecifiedExprs,
7179+
SourceLocation InitLoc,
7180+
SourceLocation LParenLoc,
7181+
SourceLocation RParenLoc);
71707182

71717183
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
71727184
/// fragments (e.g. "foo" "bar" L"baz"). The result string has to handle

clang/lib/AST/ASTImporter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,11 +2628,12 @@ ExpectedDecl ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {
26282628
if (!Name) {
26292629
// This is an anonymous namespace. Adopt an existing anonymous
26302630
// namespace if we can.
2631-
// FIXME: Not testable.
2632-
if (auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2631+
DeclContext *EnclosingDC = DC->getEnclosingNamespaceContext();
2632+
if (auto *TU = dyn_cast<TranslationUnitDecl>(EnclosingDC))
26332633
MergeWithNamespace = TU->getAnonymousNamespace();
26342634
else
2635-
MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
2635+
MergeWithNamespace =
2636+
cast<NamespaceDecl>(EnclosingDC)->getAnonymousNamespace();
26362637
} else {
26372638
SmallVector<NamedDecl *, 4> ConflictingDecls;
26382639
auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,11 +1684,6 @@ mlir::Value ScalarExprEmitter::VisitInitListExpr(InitListExpr *e) {
16841684
return {};
16851685
}
16861686

1687-
if (numInitElements == 0) {
1688-
cgf.cgm.errorNYI(e->getSourceRange(), "InitListExpr with 0 init elements");
1689-
return {};
1690-
}
1691-
16921687
if (e->getType()->isVectorType()) {
16931688
const auto vectorType =
16941689
mlir::cast<cir::VectorType>(cgf.convertType(e->getType()));
@@ -1710,6 +1705,12 @@ mlir::Value ScalarExprEmitter::VisitInitListExpr(InitListExpr *e) {
17101705
cgf.getLoc(e->getSourceRange()), vectorType, elements);
17111706
}
17121707

1708+
if (numInitElements == 0) {
1709+
cgf.cgm.errorNYI(e->getSourceRange(),
1710+
"InitListExpr Non VectorType with 0 init elements");
1711+
return {};
1712+
}
1713+
17131714
return Visit(e->getInit(0));
17141715
}
17151716

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "CGCXXABI.h"
1414
#include "CGCleanup.h"
1515
#include "CGDebugInfo.h"
16+
#include "CGHLSLRuntime.h"
1617
#include "CGObjCRuntime.h"
1718
#include "CGOpenMPRuntime.h"
1819
#include "CGRecordLayout.h"
@@ -2095,6 +2096,18 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
20952096
assert (Ignore == false && "init list ignored");
20962097
unsigned NumInitElements = E->getNumInits();
20972098

2099+
// HLSL initialization lists in the AST are an expansion which can contain
2100+
// side-effecting expressions wrapped in opaque value expressions. To properly
2101+
// emit these we need to emit the opaque values before we emit the argument
2102+
// expressions themselves. This is a little hacky, but it prevents us needing
2103+
// to do a bigger AST-level change for a language feature that we need
2104+
// deprecate in the near future. See related HLSL language proposals in the
2105+
// proposals (https://github.com/microsoft/hlsl-specs/blob/main/proposals):
2106+
// * 0005-strict-initializer-lists.md
2107+
// * 0032-constructors.md
2108+
if (CGF.getLangOpts().HLSL)
2109+
CGF.CGM.getHLSLRuntime().emitInitListOpaqueValues(CGF, E);
2110+
20982111
if (E->hadArrayRangeDesignator())
20992112
CGF.ErrorUnsupported(E, "GNU array range designator extension");
21002113

clang/lib/CodeGen/TargetBuiltins/RISCV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
388388
case RISCV::BI__builtin_riscv_cv_alu_exthz:
389389
return Builder.CreateZExt(Builder.CreateTrunc(Ops[0], Int16Ty), Int32Ty,
390390
"exthz");
391-
case RISCV::BI__builtin_riscv_cv_alu_slet:
391+
case RISCV::BI__builtin_riscv_cv_alu_sle:
392392
return Builder.CreateZExt(Builder.CreateICmpSLE(Ops[0], Ops[1]), Int32Ty,
393393
"sle");
394-
case RISCV::BI__builtin_riscv_cv_alu_sletu:
394+
case RISCV::BI__builtin_riscv_cv_alu_sleu:
395395
return Builder.CreateZExt(Builder.CreateICmpULE(Ops[0], Ops[1]), Int32Ty,
396396
"sleu");
397397
case RISCV::BI__builtin_riscv_cv_alu_subN:

0 commit comments

Comments
 (0)