Skip to content

Commit d7815e4

Browse files
Merge branch 'main' into mlir-llvm-target-features
2 parents e97a55c + d8747ea commit d7815e4

File tree

523 files changed

+15212
-6843
lines changed

Some content is hidden

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

523 files changed

+15212
-6843
lines changed

.github/workflows/issue-write.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: 'Comment on PR'
4141
if: steps.download-artifact.outputs.artifact-id != ''
42-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
42+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
4343
with:
4444
github-token: ${{ secrets.GITHUB_TOKEN }}
4545
script: |

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/docs/ReleaseNotes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ AST Dumping Potentially Breaking Changes
6262
Clang Frontend Potentially Breaking Changes
6363
-------------------------------------------
6464

65+
- The ``-Wglobal-constructors`` flag now applies to ``[[gnu::constructor]]`` and
66+
``[[gnu::destructor]]`` attributes.
67+
6568
Clang Python Bindings Potentially Breaking Changes
6669
--------------------------------------------------
6770

@@ -108,6 +111,13 @@ C Language Changes
108111

109112
C2y Feature Support
110113
^^^^^^^^^^^^^^^^^^^
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;``.
118+
- Implemented `WG14 N3411 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3411.pdf>`_
119+
which allows a source file to not end with a newline character. This is still
120+
reported as a conforming extension in earlier language modes.
111121

112122
C23 Feature Support
113123
^^^^^^^^^^^^^^^^^^^
@@ -145,6 +155,7 @@ Adding [[clang::unsafe_buffer_usage]] attribute to a method definition now turns
145155
related warnings within the method body.
146156

147157
- The ``no_sanitize`` attribute now accepts both ``gnu`` and ``clang`` names.
158+
- The ``ext_vector_type(n)`` attribute can now be used as a generic type attribute.
148159
- Clang now diagnoses use of declaration attributes on void parameters. (#GH108819)
149160
- Clang now allows ``__attribute__((model("small")))`` and
150161
``__attribute__((model("large")))`` on non-TLS globals in x86-64 compilations.
@@ -245,6 +256,7 @@ Bug Fixes in This Version
245256

246257
- Clang now outputs correct values when #embed data contains bytes with negative
247258
signed char values (#GH102798).
259+
- Fixed a crash when merging named enumerations in modules (#GH114240).
248260
- Fixed rejects-valid problem when #embed appears in std::initializer_list or
249261
when it can affect template argument deduction (#GH122306).
250262
- Fix crash on code completion of function calls involving partial order of function templates
@@ -296,6 +308,7 @@ Improvements to C++ diagnostics
296308
Bug Fixes to AST Handling
297309
^^^^^^^^^^^^^^^^^^^^^^^^^
298310
- Fixed type checking when a statement expression ends in an l-value of atomic type. (#GH106576)
311+
- Fixed uninitialized use check in a lambda within CXXOperatorCallExpr. (#GH129198)
299312

300313
Miscellaneous Bug Fixes
301314
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,17 +1721,10 @@ def EnableIf : InheritableAttr {
17211721
let Documentation = [EnableIfDocs];
17221722
}
17231723

1724-
def ExtVectorType : Attr {
1725-
// This is an OpenCL-related attribute and does not receive a [[]] spelling.
1726-
let Spellings = [GNU<"ext_vector_type">];
1727-
// FIXME: This subject list is wrong; this is a type attribute.
1728-
let Subjects = SubjectList<[TypedefName], ErrorDiag>;
1724+
def ExtVectorType : TypeAttr {
1725+
let Spellings = [Clang<"ext_vector_type">];
17291726
let Args = [ExprArgument<"NumElements">];
1730-
let ASTNode = 0;
1731-
let Documentation = [Undocumented];
1732-
// This is a type attribute with an incorrect subject list, so should not be
1733-
// permitted by #pragma clang attribute.
1734-
let PragmaAttributeSupport = 0;
1727+
let Documentation = [ExtVectorTypeDocs];
17351728
}
17361729

17371730
def FallThrough : StmtAttr {

clang/include/clang/Basic/AttrDocs.td

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,41 @@ template instantiation, so the value for ``T::number`` is known.
11131113
}];
11141114
}
11151115

1116+
def ExtVectorTypeDocs : Documentation {
1117+
let Category = DocCatFunction;
1118+
let Content = [{
1119+
The ``ext_vector_type(N)`` attribute specifies that a type is a vector with N
1120+
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.
1123+
This attribute enables efficient SIMD operations and is usable in
1124+
general-purpose code.
1125+
1126+
.. code-block:: c++
1127+
1128+
template <typename T, uint32_t N>
1129+
constexpr T simd_reduce(T [[clang::ext_vector_type(N)]] v) {
1130+
static_assert((N & (N - 1)) == 0, "N must be a power of two");
1131+
if constexpr (N == 1)
1132+
return v[0];
1133+
else
1134+
return simd_reduce<T, N / 2>(v.hi + v.lo);
1135+
}
1136+
1137+
The vector type also supports swizzling up to sixteen elements. This can be done
1138+
using the object accessors. The OpenCL documentation lists all of the accepted
1139+
values.
1140+
1141+
.. code-block:: c++
1142+
1143+
using f16_x16 = _Float16 __attribute__((ext_vector_type(16)));
1144+
1145+
f16_x16 reverse(f16_x16 v) { return v.sfedcba9876543210; }
1146+
1147+
See the OpenCL documentation for some more complete examples.
1148+
}];
1149+
}
1150+
11161151
def DiagnoseIfDocs : Documentation {
11171152
let Category = DocCatFunction;
11181153
let Content = [{

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def err_decomp_decl_constraint : Error<
551551
def err_decomp_decl_parens : Error<
552552
"decomposition declaration cannot be declared with parentheses">;
553553
def err_decomp_decl_template : Error<
554-
"decomposition declaration template not supported">;
554+
"decomposition declaration cannot be a template">;
555555
def err_decomp_decl_not_alone : Error<
556556
"decomposition declaration must be the only declaration in its group">;
557557
def err_decomp_decl_requires_init : Error<
@@ -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
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@ struct MissingFeatures {
4141
static bool supportComdat() { return false; }
4242

4343
// Load/store attributes
44-
static bool opLoadThreadLocal() { return false; }
44+
static bool opLoadStoreThreadLocal() { return false; }
4545
static bool opLoadEmitScalarRangeCheck() { return false; }
4646
static bool opLoadBooleanRepresentation() { return false; }
4747
static bool opLoadStoreTbaa() { return false; }
4848
static bool opLoadStoreMemOrder() { return false; }
4949
static bool opLoadStoreVolatile() { return false; }
5050
static bool opLoadStoreAlignment() { return false; }
51+
static bool opLoadStoreAtomic() { return false; }
52+
static bool opLoadStoreObjC() { return false; }
5153

5254
// AllocaOp handling
53-
static bool opAllocaVarDeclContext() { return false; }
5455
static bool opAllocaStaticLocal() { return false; }
5556
static bool opAllocaNonGC() { return false; }
5657
static bool opAllocaImpreciseLifetime() { return false; }
@@ -61,6 +62,7 @@ struct MissingFeatures {
6162
static bool opAllocaReference() { return false; }
6263
static bool opAllocaAnnotations() { return false; }
6364
static bool opAllocaDynAllocSize() { return false; }
65+
static bool opAllocaCaptureByInit() { return false; }
6466

6567
// FuncOp handling
6668
static bool opFuncOpenCLKernelMetadata() { return false; }
@@ -76,6 +78,10 @@ struct MissingFeatures {
7678
static bool constructABIArgDirectExtend() { return false; }
7779
static bool opGlobalViewAttr() { return false; }
7880
static bool lowerModeOptLevel() { return false; }
81+
static bool opTBAA() { return false; }
82+
static bool objCLifetime() { return false; }
83+
static bool emitNullabilityCheck() { return false; }
84+
static bool astVarDeclInterface() { return false; }
7985
};
8086

8187
} // namespace cir

clang/include/clang/Driver/Action.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ class Action {
7575
LinkerWrapperJobClass,
7676
StaticLibJobClass,
7777
BinaryAnalyzeJobClass,
78+
BinaryTranslatorJobClass,
7879

7980
JobClassFirst = PreprocessJobClass,
80-
JobClassLast = BinaryAnalyzeJobClass
81+
JobClassLast = BinaryTranslatorJobClass
8182
};
8283

8384
// The offloading kind determines if this action is binded to a particular
@@ -675,6 +676,17 @@ class BinaryAnalyzeJobAction : public JobAction {
675676
}
676677
};
677678

679+
class BinaryTranslatorJobAction : public JobAction {
680+
void anchor() override;
681+
682+
public:
683+
BinaryTranslatorJobAction(Action *Input, types::ID Type);
684+
685+
static bool classof(const Action *A) {
686+
return A->getKind() == BinaryTranslatorJobClass;
687+
}
688+
};
689+
678690
} // namespace driver
679691
} // namespace clang
680692

0 commit comments

Comments
 (0)