Skip to content

Commit c876464

Browse files
committed
Merge branch 'upstream' into x86-demandedelts-vpermv-vpermv3
2 parents 0836965 + 3843dfe commit c876464

File tree

107 files changed

+3631
-2029
lines changed

Some content is hidden

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

107 files changed

+3631
-2029
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ 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
-------------------------------------------------
@@ -311,6 +313,8 @@ Improvements to Clang's diagnostics
311313
312314
Fixes #GH61635
313315

316+
- 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.
317+
314318
Improvements to Clang's time-trace
315319
----------------------------------
316320

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

341348
Bug Fixes to Compiler Builtins
342349
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
496496
def IgnoredGCH : DiagGroup<"ignored-gch">;
497497
def IgnoredReferenceQualifiers : DiagGroup<"ignored-reference-qualifiers">;
498498
def IgnoredQualifiers : DiagGroup<"ignored-qualifiers", [IgnoredReferenceQualifiers]>;
499+
def IgnoredBaseClassQualifiers : DiagGroup<"ignored-base-class-qualifiers", [IgnoredQualifiers]>;
499500
def : DiagGroup<"import">;
500501
def GNUIncludeNext : DiagGroup<"gnu-include-next">;
501502
def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def warn_qual_return_type : Warning<
545545
InGroup<IgnoredQualifiers>, DefaultIgnore;
546546
def warn_qual_base_type : Warning<
547547
"'%0' qualifier%s1 on base class type %2 %plural{1:has|:have}1 no effect">,
548-
InGroup<IgnoredQualifiers>, DefaultIgnore;
548+
InGroup<IgnoredBaseClassQualifiers>, DefaultIgnore;
549549

550550
def warn_deprecated_redundant_constexpr_static_def : Warning<
551551
"out-of-line definition of constexpr static data member is redundant "

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14597,8 +14597,9 @@ class Sema final : public SemaBase {
1459714597
/// occurred and satisfaction could not be determined.
1459814598
///
1459914599
/// \returns true if an error occurred, false otherwise.
14600-
bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
14601-
ConstraintSatisfaction &Satisfaction);
14600+
bool
14601+
CheckConstraintSatisfaction(const ConceptSpecializationExpr *ConstraintExpr,
14602+
ConstraintSatisfaction &Satisfaction);
1460214603

1460314604
/// Check whether the given function decl's trailing requires clause is
1460414605
/// satisfied, if any. Returns false and updates Satisfaction with the

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ static const SanitizerMask SupportsCoverage =
5454
SanitizerKind::FuzzerNoLink | SanitizerKind::FloatDivideByZero |
5555
SanitizerKind::SafeStack | SanitizerKind::ShadowCallStack |
5656
SanitizerKind::Thread | SanitizerKind::ObjCCast | SanitizerKind::KCFI |
57-
SanitizerKind::NumericalStability | SanitizerKind::Vptr;
57+
SanitizerKind::NumericalStability | SanitizerKind::Vptr |
58+
SanitizerKind::CFI;
5859
static const SanitizerMask RecoverableByDefault =
5960
SanitizerKind::Undefined | SanitizerKind::Integer |
6061
SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |

clang/lib/Headers/stdint.h

Lines changed: 18 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -317,166 +317,55 @@ typedef __UINTMAX_TYPE__ uintmax_t;
317317
* integer width that the target implements, so corresponding macros are
318318
* defined below, too.
319319
*
320-
* These macros are defined using the same successive-shrinking approach as
321-
* the type definitions above. It is likewise important that macros are defined
322-
* in order of decending width.
323-
*
324320
* Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
325321
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
326322
*/
327323

328-
#define __int_c_join(a, b) a ## b
329-
#define __int_c(v, suffix) __int_c_join(v, suffix)
330-
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
331-
332-
333-
#ifdef __INT64_TYPE__
334-
# undef __int64_c_suffix
335-
# undef __int32_c_suffix
336-
# undef __int16_c_suffix
337-
# undef __int8_c_suffix
338-
# ifdef __INT64_C_SUFFIX__
339-
# define __int64_c_suffix __INT64_C_SUFFIX__
340-
# define __int32_c_suffix __INT64_C_SUFFIX__
341-
# define __int16_c_suffix __INT64_C_SUFFIX__
342-
# define __int8_c_suffix __INT64_C_SUFFIX__
343-
# endif /* __INT64_C_SUFFIX__ */
344-
#endif /* __INT64_TYPE__ */
345-
346324
#ifdef __int_least64_t
347-
# ifdef __int64_c_suffix
348-
# define INT64_C(v) __int_c(v, __int64_c_suffix)
349-
# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
350-
# else
351-
# define INT64_C(v) v
352-
# define UINT64_C(v) v ## U
353-
# endif /* __int64_c_suffix */
325+
#define INT64_C(v) __INT64_C(v)
326+
#define UINT64_C(v) __UINT64_C(v)
354327
#endif /* __int_least64_t */
355328

356329

357330
#ifdef __INT56_TYPE__
358-
# undef __int32_c_suffix
359-
# undef __int16_c_suffix
360-
# undef __int8_c_suffix
361-
# ifdef __INT56_C_SUFFIX__
362-
# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
363-
# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
364-
# define __int32_c_suffix __INT56_C_SUFFIX__
365-
# define __int16_c_suffix __INT56_C_SUFFIX__
366-
# define __int8_c_suffix __INT56_C_SUFFIX__
367-
# else
368-
# define INT56_C(v) v
369-
# define UINT56_C(v) v ## U
370-
# endif /* __INT56_C_SUFFIX__ */
331+
#define INT56_C(v) __INT56_C(v)
332+
#define UINT56_C(v) __UINT56_C(v)
371333
#endif /* __INT56_TYPE__ */
372334

373335

374336
#ifdef __INT48_TYPE__
375-
# undef __int32_c_suffix
376-
# undef __int16_c_suffix
377-
# undef __int8_c_suffix
378-
# ifdef __INT48_C_SUFFIX__
379-
# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
380-
# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
381-
# define __int32_c_suffix __INT48_C_SUFFIX__
382-
# define __int16_c_suffix __INT48_C_SUFFIX__
383-
# define __int8_c_suffix __INT48_C_SUFFIX__
384-
# else
385-
# define INT48_C(v) v
386-
# define UINT48_C(v) v ## U
387-
# endif /* __INT48_C_SUFFIX__ */
337+
#define INT48_C(v) __INT48_C(v)
338+
#define UINT48_C(v) __UINT48_C(v)
388339
#endif /* __INT48_TYPE__ */
389340

390341

391342
#ifdef __INT40_TYPE__
392-
# undef __int32_c_suffix
393-
# undef __int16_c_suffix
394-
# undef __int8_c_suffix
395-
# ifdef __INT40_C_SUFFIX__
396-
# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
397-
# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
398-
# define __int32_c_suffix __INT40_C_SUFFIX__
399-
# define __int16_c_suffix __INT40_C_SUFFIX__
400-
# define __int8_c_suffix __INT40_C_SUFFIX__
401-
# else
402-
# define INT40_C(v) v
403-
# define UINT40_C(v) v ## U
404-
# endif /* __INT40_C_SUFFIX__ */
343+
#define INT40_C(v) __INT40_C(v)
344+
#define UINT40_C(v) __UINT40_C(v)
405345
#endif /* __INT40_TYPE__ */
406346

407347

408-
#ifdef __INT32_TYPE__
409-
# undef __int32_c_suffix
410-
# undef __int16_c_suffix
411-
# undef __int8_c_suffix
412-
# ifdef __INT32_C_SUFFIX__
413-
# define __int32_c_suffix __INT32_C_SUFFIX__
414-
# define __int16_c_suffix __INT32_C_SUFFIX__
415-
# define __int8_c_suffix __INT32_C_SUFFIX__
416-
# endif /* __INT32_C_SUFFIX__ */
417-
#endif /* __INT32_TYPE__ */
418-
419348
#ifdef __int_least32_t
420-
# ifdef __int32_c_suffix
421-
# define INT32_C(v) __int_c(v, __int32_c_suffix)
422-
# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
423-
# else
424-
# define INT32_C(v) v
425-
# define UINT32_C(v) v ## U
426-
# endif /* __int32_c_suffix */
349+
#define INT32_C(v) __INT32_C(v)
350+
#define UINT32_C(v) __UINT32_C(v)
427351
#endif /* __int_least32_t */
428352

429353

430354
#ifdef __INT24_TYPE__
431-
# undef __int16_c_suffix
432-
# undef __int8_c_suffix
433-
# ifdef __INT24_C_SUFFIX__
434-
# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
435-
# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
436-
# define __int16_c_suffix __INT24_C_SUFFIX__
437-
# define __int8_c_suffix __INT24_C_SUFFIX__
438-
# else
439-
# define INT24_C(v) v
440-
# define UINT24_C(v) v ## U
441-
# endif /* __INT24_C_SUFFIX__ */
355+
#define INT24_C(v) __INT24_C(v)
356+
#define UINT24_C(v) __UINT24_C(v)
442357
#endif /* __INT24_TYPE__ */
443358

444359

445-
#ifdef __INT16_TYPE__
446-
# undef __int16_c_suffix
447-
# undef __int8_c_suffix
448-
# ifdef __INT16_C_SUFFIX__
449-
# define __int16_c_suffix __INT16_C_SUFFIX__
450-
# define __int8_c_suffix __INT16_C_SUFFIX__
451-
# endif /* __INT16_C_SUFFIX__ */
452-
#endif /* __INT16_TYPE__ */
453-
454360
#ifdef __int_least16_t
455-
# ifdef __int16_c_suffix
456-
# define INT16_C(v) __int_c(v, __int16_c_suffix)
457-
# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
458-
# else
459-
# define INT16_C(v) v
460-
# define UINT16_C(v) v ## U
461-
# endif /* __int16_c_suffix */
361+
#define INT16_C(v) __INT16_C(v)
362+
#define UINT16_C(v) __UINT16_C(v)
462363
#endif /* __int_least16_t */
463364

464365

465-
#ifdef __INT8_TYPE__
466-
# undef __int8_c_suffix
467-
# ifdef __INT8_C_SUFFIX__
468-
# define __int8_c_suffix __INT8_C_SUFFIX__
469-
# endif /* __INT8_C_SUFFIX__ */
470-
#endif /* __INT8_TYPE__ */
471-
472366
#ifdef __int_least8_t
473-
# ifdef __int8_c_suffix
474-
# define INT8_C(v) __int_c(v, __int8_c_suffix)
475-
# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
476-
# else
477-
# define INT8_C(v) v
478-
# define UINT8_C(v) v ## U
479-
# endif /* __int8_c_suffix */
367+
#define INT8_C(v) __INT8_C(v)
368+
#define UINT8_C(v) __UINT8_C(v)
480369
#endif /* __int_least8_t */
481370

482371

@@ -938,8 +827,8 @@ typedef __UINTMAX_TYPE__ uintmax_t;
938827
#endif
939828

940829
/* 7.18.4.2 Macros for greatest-width integer constants. */
941-
#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
942-
#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
830+
#define INTMAX_C(v) __INTMAX_C(v)
831+
#define UINTMAX_C(v) __UINTMAX_C(v)
943832

944833
/* C23 7.22.3.x Width of other integer types. */
945834
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L

clang/lib/Sema/SemaCast.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,10 +3091,10 @@ void CastOperation::CheckCStyleCast() {
30913091
return;
30923092
}
30933093

3094-
// C23 6.5.4p4:
3095-
// The type nullptr_t shall not be converted to any type other than void,
3096-
// bool, or a pointer type. No type other than nullptr_t shall be converted
3097-
// to nullptr_t.
3094+
// C23 6.5.5p4:
3095+
// ... The type nullptr_t shall not be converted to any type other than
3096+
// void, bool or a pointer type.If the target type is nullptr_t, the cast
3097+
// expression shall be a null pointer constant or have type nullptr_t.
30983098
if (SrcType->isNullPtrType()) {
30993099
// FIXME: 6.3.2.4p2 says that nullptr_t can be converted to itself, but
31003100
// 6.5.4p4 is a constraint check and nullptr_t is not void, bool, or a
@@ -3115,11 +3115,20 @@ void CastOperation::CheckCStyleCast() {
31153115
Self.CurFPFeatureOverrides());
31163116
}
31173117
}
3118+
31183119
if (DestType->isNullPtrType() && !SrcType->isNullPtrType()) {
3119-
Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast)
3120-
<< /*type to nullptr*/ 1 << SrcType;
3121-
SrcExpr = ExprError();
3122-
return;
3120+
if (!SrcExpr.get()->isNullPointerConstant(Self.Context,
3121+
Expr::NPC_NeverValueDependent)) {
3122+
Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast)
3123+
<< /*type to nullptr*/ 1 << SrcType;
3124+
SrcExpr = ExprError();
3125+
return;
3126+
}
3127+
// Need to convert the source from whatever its type is to a null pointer
3128+
// type first.
3129+
SrcExpr = ImplicitCastExpr::Create(Self.Context, DestType, CK_NullToPointer,
3130+
SrcExpr.get(), nullptr, VK_PRValue,
3131+
Self.CurFPFeatureOverrides());
31233132
}
31243133

31253134
if (DestType->isExtVectorType()) {

0 commit comments

Comments
 (0)