Skip to content

Commit 877723b

Browse files
committed
Merge branch 'upstream' into ic-sext-split
2 parents 57792b5 + a1b14db commit 877723b

File tree

324 files changed

+15680
-15721
lines changed

Some content is hidden

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

324 files changed

+15680
-15721
lines changed

.github/workflows/libclang-python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
python-version: ["3.8", "3.11"]
33+
python-version: ["3.8", "3.13"]
3434
uses: ./.github/workflows/llvm-project-tests.yml
3535
with:
3636
build_target: check-clang-python

clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ AST_MATCHER(FunctionDecl, hasBody) { return Node.hasBody(); }
5252
static bool isInMainFile(SourceLocation L, SourceManager &SM,
5353
const FileExtensionsSet &HeaderFileExtensions) {
5454
for (;;) {
55-
if (utils::isSpellingLocInHeaderFile(L, SM, HeaderFileExtensions))
55+
if (utils::isExpansionLocInHeaderFile(L, SM, HeaderFileExtensions))
5656
return false;
5757
if (SM.isInMainFile(L))
5858
return true;

clang-tools-extra/clangd/IncludeFixer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ std::vector<Fix> IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel,
8484
case diag::err_array_incomplete_or_sizeless_type:
8585
case diag::err_array_size_incomplete_type:
8686
case diag::err_asm_incomplete_type:
87-
case diag::err_assoc_type_incomplete:
8887
case diag::err_bad_cast_incomplete:
8988
case diag::err_call_function_incomplete_return:
9089
case diag::err_call_incomplete_argument:

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ Changes in existing checks
129129
<clang-tidy/checks/misc/redundant-expression>` check by providing additional
130130
examples and fixing some macro related false positives.
131131

132+
- Improved :doc:`misc-use-internal-linkage
133+
<clang-tidy/checks/misc/use-internal-linkage>` check by fix false positives
134+
for function or variable in header file which contains macro expansion.
135+
132136
- Improved :doc:`performance/unnecessary-value-param
133137
<clang-tidy/checks/performance/unnecessary-value-param>` check performance by
134138
tolerating fix-it breaking compilation when functions is used as pointers
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- -- -I%S/Inputs/use-internal-linkage
2+
3+
#define B A##C
4+
5+
inline void B() {}

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ C Language Changes
111111

112112
C2y Feature Support
113113
^^^^^^^^^^^^^^^^^^^
114+
- Implement `WG14 N3409 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3409.pdf>`_
115+
which removes UB around use of ``void`` expressions. In practice, this means
116+
that ``_Generic`` selection associations may now have ``void`` type, but it
117+
also removes UB with code like ``(void)(void)1;``.
114118
- Implemented `WG14 N3411 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3411.pdf>`_
115119
which allows a source file to not end with a newline character. This is still
116120
reported as a conforming extension in earlier language modes.

clang/include/clang/Basic/AttrDocs.td

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,10 @@ template instantiation, so the value for ``T::number`` is known.
11161116
def ExtVectorTypeDocs : Documentation {
11171117
let Category = DocCatFunction;
11181118
let Content = [{
1119-
The ext_vector_type(N) attribute specifies that a type is a vector with N
1119+
The ``ext_vector_type(N)`` attribute specifies that a type is a vector with N
11201120
elements, directly mapping to an LLVM vector type. Originally from OpenCL, it
1121-
allows element access the array subscript operator ``[]``, ``sN`` where ``N`` is
1122-
a hexadecimal value, or ``x``, ``y``, ``z``, ``w`` for graphics-style indexing.
1121+
allows element access the array subscript operator ``[]``, ``sN`` where N is
1122+
a hexadecimal value, or ``x, y, z, w`` for graphics-style indexing.
11231123
This attribute enables efficient SIMD operations and is usable in
11241124
general-purpose code.
11251125

@@ -1128,17 +1128,16 @@ general-purpose code.
11281128
template <typename T, uint32_t N>
11291129
constexpr T simd_reduce(T [[clang::ext_vector_type(N)]] v) {
11301130
static_assert((N & (N - 1)) == 0, "N must be a power of two");
1131-
if constexpr (N == 1) {
1131+
if constexpr (N == 1)
11321132
return v[0];
1133-
} else {
1134-
T [[clang::ext_vector_type(N / 2)]] reduced = v.hi + v.lo;
1135-
return simd_reduce(reduced);
1136-
}
1133+
else
1134+
return simd_reduce<T, N / 2>(v.hi + v.lo);
11371135
}
11381136

11391137
The vector type also supports swizzling up to sixteen elements. This can be done
1140-
using the object accessors. The OpenCL documentation lists the full list of
1141-
accepted values.
1138+
using the object accessors. The OpenCL documentation lists all of the accepted
1139+
values.
1140+
11421141
.. code-block:: c++
11431142

11441143
using f16_x16 = _Float16 __attribute__((ext_vector_type(16)));

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10425,8 +10425,13 @@ def warn_type_safety_null_pointer_required : Warning<
1042510425
"specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
1042610426

1042710427
// Generic selections.
10428-
def err_assoc_type_incomplete : Error<
10429-
"type %0 in generic association incomplete">;
10428+
def ext_assoc_type_incomplete : Extension<
10429+
"incomplete type %0 in a '_Generic' association is a C2y extension">,
10430+
InGroup<C2y>;
10431+
def warn_c2y_compat_assoc_type_incomplete : Warning<
10432+
"use of incomplete type %0 in a '_Generic' association is incompatible with "
10433+
"C standards before C2y">,
10434+
InGroup<CPre2yCompat>, DefaultIgnore;
1043010435
def err_assoc_type_nonobject : Error<
1043110436
"type %0 in generic association not an object type">;
1043210437
def err_assoc_type_variably_modified : Error<

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
2626
CIRBaseBuilderTy(mlir::MLIRContext &mlirContext)
2727
: mlir::OpBuilder(&mlirContext) {}
2828

29+
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr) {
30+
return create<cir::ConstantOp>(loc, attr.getType(), attr);
31+
}
32+
2933
cir::ConstantOp getBool(bool state, mlir::Location loc) {
3034
return create<cir::ConstantOp>(loc, getBoolTy(), getCIRBoolAttr(state));
3135
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
5454
}];
5555
}
5656

57+
//===----------------------------------------------------------------------===//
58+
// ZeroAttr
59+
//===----------------------------------------------------------------------===//
60+
61+
def ZeroAttr : CIR_Attr<"Zero", "zero", [TypedAttrInterface]> {
62+
let summary = "Attribute to represent zero initialization";
63+
let description = [{
64+
The ZeroAttr is used to indicate zero initialization on structs.
65+
}];
66+
67+
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
68+
let assemblyFormat = [{}];
69+
}
70+
5771
//===----------------------------------------------------------------------===//
5872
// UndefAttr
5973
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)