Skip to content

Commit 67c74fc

Browse files
committed
Merge remote-tracking branch 'origin/main' into aballman-gh42199
2 parents f561ae3 + a095ebc commit 67c74fc

File tree

341 files changed

+17077
-3535
lines changed

Some content is hidden

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

341 files changed

+17077
-3535
lines changed

clang-tools-extra/clangd/unittests/InlayHintTests.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
15771577
}
15781578

15791579
TEST(TypeHints, CallingConvention) {
1580-
// Check that we don't crash for lambdas without a FunctionTypeLoc
1580+
// Check that we don't crash for lambdas with an annotation
15811581
// https://github.com/clangd/clangd/issues/2223
1582-
std::string Code = R"cpp(
1582+
Annotations Source(R"cpp(
15831583
void test() {
1584-
[]() __cdecl {};
1584+
[]($lambda[[)]]__cdecl {};
15851585
}
1586-
)cpp";
1587-
TestTU TU = TestTU::withCode(Code);
1586+
)cpp");
1587+
TestTU TU = TestTU::withCode(Source.code());
15881588
TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
15891589
TU.PredefineMacros = true; // for the __cdecl
15901590
auto AST = TU.build();
15911591

1592-
EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
1592+
EXPECT_THAT(
1593+
hintsOfKind(AST, InlayHintKind::Type),
1594+
ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
15931595
}
15941596

15951597
TEST(TypeHints, Decltype) {

clang-tools-extra/clangd/unittests/XRefsTests.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,15 @@ TEST(FindReferences, WithinAST) {
23032303
bool $decl[[operator]]"" _u^dl(unsigned long long value);
23042304
bool x = $(x)[[1_udl]];
23052305
)cpp",
2306-
};
2306+
R"cpp(
2307+
struct S {
2308+
public:
2309+
static void $decl(S)[[operator]] delete(void *);
2310+
static void deleteObject(S *S) {
2311+
$(S::deleteObject)[[de^lete]] S;
2312+
}
2313+
};
2314+
)cpp"};
23072315
for (const char *Test : Tests)
23082316
checkFindRefs(Test);
23092317
}

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ related warnings within the method body.
301301
particularly relevant for AMDGPU targets, where they map to corresponding IR
302302
metadata.
303303

304+
- Clang now disallows the use of attributes applied before an
305+
``extern template`` declaration (#GH79893).
306+
304307
Improvements to Clang's diagnostics
305308
-----------------------------------
306309

@@ -398,6 +401,8 @@ Improvements to Clang's diagnostics
398401
- Analysis-based diagnostics (like ``-Wconsumed`` or ``-Wunreachable-code``)
399402
can now be correctly controlled by ``#pragma clang diagnostic``. #GH42199
400403

404+
- Improved Clang's error recovery for invalid function calls.
405+
401406
- Improved bit-field diagnostics to consider the type specified by the
402407
``preferred_type`` attribute. These diagnostics are controlled by the flags
403408
``-Wpreferred-type-bitfield-enum-conversion`` and

clang/include/clang/Basic/BuiltinHeaders.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
HEADER(NO_HEADER, nullptr)
15+
HEADER(ARMACLE_H, "arm_acle.h")
1516
HEADER(BLOCKS_H, "Blocks.h")
1617
HEADER(COMPLEX_H, "complex.h")
1718
HEADER(CTYPE_H, "ctype.h")

clang/include/clang/Basic/BuiltinsAArch64.def

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ BUILTIN(__builtin_arm_wfi, "v", "")
5050
BUILTIN(__builtin_arm_sev, "v", "")
5151
BUILTIN(__builtin_arm_sevl, "v", "")
5252
BUILTIN(__builtin_arm_chkfeat, "WUiWUi", "")
53+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
54+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
55+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
56+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
57+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
5358

5459
// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
5560
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
@@ -82,6 +87,9 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
8287
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
8388
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
8489
BUILTIN(__builtin_arm_isb, "vUi", "nc")
90+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
91+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
92+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
8593

8694
TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")
8795

@@ -98,16 +106,6 @@ BUILTIN(__builtin_arm_wsr64, "vcC*WUi", "nc")
98106
TARGET_BUILTIN(__builtin_arm_wsr128, "vcC*LLLUi", "nc", "d128")
99107
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
100108

101-
// MSVC
102-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
103-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
104-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
105-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
106-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
107-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
108-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
109-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
110-
111109
// Misc
112110
BUILTIN(__builtin_sponentry, "v*", "c")
113111

clang/include/clang/Basic/BuiltinsARM.def

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ BUILTIN(__builtin_arm_wfi, "v", "")
186186
BUILTIN(__builtin_arm_sev, "v", "")
187187
BUILTIN(__builtin_arm_sevl, "v", "")
188188
BUILTIN(__builtin_arm_dbg, "vUi", "")
189+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
190+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
191+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
192+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
193+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
189194

190195
// Data barrier
191196
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
192197
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
193198
BUILTIN(__builtin_arm_isb, "vUi", "nc")
199+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
200+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
201+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
194202

195203
// Prefetch
196204
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
@@ -209,15 +217,6 @@ BUILTIN(__builtin_sponentry, "v*", "c")
209217
// MSVC
210218
LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
211219

212-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
213-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
214-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
215-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
216-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
217-
218-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
219-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
220-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
221220
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
222221
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
223222
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
6161

6262
mlir::Value getConstAPInt(mlir::Location loc, mlir::Type typ,
6363
const llvm::APInt &val) {
64-
return create<cir::ConstantOp>(loc, typ, getAttr<cir::IntAttr>(typ, val));
64+
return create<cir::ConstantOp>(loc, getAttr<cir::IntAttr>(typ, val));
6565
}
6666

6767
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr) {
68-
return create<cir::ConstantOp>(loc, attr.getType(), attr);
68+
return create<cir::ConstantOp>(loc, attr);
6969
}
7070

7171
cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty,
@@ -83,21 +83,17 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
8383
return getConstPtrAttr(t, 0);
8484
}
8585

86-
mlir::TypedAttr getZeroAttr(mlir::Type t) {
87-
return cir::ZeroAttr::get(getContext(), t);
88-
}
89-
9086
mlir::TypedAttr getZeroInitAttr(mlir::Type ty) {
9187
if (mlir::isa<cir::IntType>(ty))
9288
return cir::IntAttr::get(ty, 0);
9389
if (cir::isAnyFloatingPointType(ty))
9490
return cir::FPAttr::getZero(ty);
9591
if (auto arrTy = mlir::dyn_cast<cir::ArrayType>(ty))
96-
return getZeroAttr(arrTy);
92+
return cir::ZeroAttr::get(arrTy);
9793
if (auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty))
9894
return getConstNullPtrAttr(ptrTy);
9995
if (auto recordTy = mlir::dyn_cast<cir::RecordType>(ty))
100-
return getZeroAttr(recordTy);
96+
return cir::ZeroAttr::get(recordTy);
10197
if (mlir::isa<cir::BoolType>(ty)) {
10298
return getFalseAttr();
10399
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ def ZeroAttr : CIR_Attr<"Zero", "zero", [TypedAttrInterface]> {
7171
}];
7272

7373
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
74+
75+
let builders = [
76+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
77+
return $_get(type.getContext(), type);
78+
}]>
79+
];
80+
7481
let assemblyFormat = [{}];
7582
}
7683

@@ -86,6 +93,13 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
8693
}];
8794

8895
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
96+
97+
let builders = [
98+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
99+
return $_get(type.getContext(), type);
100+
}]>
101+
];
102+
89103
let assemblyFormat = [{}];
90104
}
91105

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,9 @@ def ConstantOp : CIR_Op<"const",
288288
```
289289
}];
290290

291-
// The constant operation takes an attribute as the only input.
292291
let arguments = (ins TypedAttrInterface:$value);
293-
294-
// The constant operation returns a single value of CIR_AnyType.
295292
let results = (outs CIR_AnyType:$res);
296293

297-
let builders = [
298-
OpBuilder<(ins "cir::BoolAttr":$value), [{
299-
build($_builder, $_state, value.getType(), value);
300-
}]>
301-
];
302-
303294
let assemblyFormat = "attr-dict $value";
304295

305296
let hasVerifier = 1;

clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct RecordTypeStorage : public mlir::TypeStorage {
5454
RecordType::RecordKind kind)
5555
: members(members), name(name), incomplete(incomplete), packed(packed),
5656
padded(padded), kind(kind) {
57-
assert(name || !incomplete && "Incomplete records must have a name");
57+
assert((name || !incomplete) && "Incomplete records must have a name");
5858
}
5959

6060
KeyTy getAsKey() const {

0 commit comments

Comments
 (0)