Skip to content

Commit 661dbb5

Browse files
authored
Merge branch 'main' into xqcia_isel
2 parents 7788bf4 + ef72b93 commit 661dbb5

File tree

321 files changed

+15847
-2962
lines changed

Some content is hidden

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

321 files changed

+15847
-2962
lines changed

clang-tools-extra/clangd/IncludeCleaner.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,9 @@ include_cleaner::Includes convertIncludes(const ParsedAST &AST) {
345345
// which is based on FileManager::getCanonicalName(ParentDir).
346346
auto FE = SM.getFileManager().getFileRef(Inc.Resolved);
347347
if (!FE) {
348-
elog("IncludeCleaner: Failed to get an entry for resolved path {0}: {1}",
349-
Inc.Resolved, FE.takeError());
348+
elog("IncludeCleaner: Failed to get an entry for resolved path '{0}' "
349+
"from include {1} : {2}",
350+
Inc.Resolved, Inc.Written, FE.takeError());
350351
continue;
351352
}
352353
TransformedInc.Resolved = *FE;

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

Lines changed: 6 additions & 1 deletion
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

@@ -395,14 +398,16 @@ Improvements to Clang's diagnostics
395398
constructors to initialize their non-modifiable members. The diagnostic is
396399
not new; being controlled via a warning group is what's new. Fixes #GH41104
397400

401+
402+
- Improved Clang's error recovery for invalid function calls.
403+
398404
- Improved bit-field diagnostics to consider the type specified by the
399405
``preferred_type`` attribute. These diagnostics are controlled by the flags
400406
``-Wpreferred-type-bitfield-enum-conversion`` and
401407
``-Wpreferred-type-bitfield-width``. These warnings are on by default as they
402408
they're only triggered if the authors are already making the choice to use
403409
``preferred_type`` attribute.
404410

405-
406411
Improvements to Clang's time-trace
407412
----------------------------------
408413

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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
5757
public:
5858
CIRBaseBuilderTy(mlir::MLIRContext &mlirContext)
5959
: mlir::OpBuilder(&mlirContext) {}
60+
CIRBaseBuilderTy(mlir::OpBuilder &builder) : mlir::OpBuilder(builder) {}
6061

6162
mlir::Value getConstAPInt(mlir::Location loc, mlir::Type typ,
6263
const llvm::APInt &val) {
63-
return create<cir::ConstantOp>(loc, typ, getAttr<cir::IntAttr>(typ, val));
64+
return create<cir::ConstantOp>(loc, getAttr<cir::IntAttr>(typ, val));
6465
}
6566

6667
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr) {
67-
return create<cir::ConstantOp>(loc, attr.getType(), attr);
68+
return create<cir::ConstantOp>(loc, attr);
6869
}
6970

7071
cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty,
@@ -82,29 +83,25 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
8283
return getConstPtrAttr(t, 0);
8384
}
8485

85-
mlir::TypedAttr getZeroAttr(mlir::Type t) {
86-
return cir::ZeroAttr::get(getContext(), t);
87-
}
88-
8986
mlir::TypedAttr getZeroInitAttr(mlir::Type ty) {
9087
if (mlir::isa<cir::IntType>(ty))
9188
return cir::IntAttr::get(ty, 0);
9289
if (cir::isAnyFloatingPointType(ty))
9390
return cir::FPAttr::getZero(ty);
9491
if (auto arrTy = mlir::dyn_cast<cir::ArrayType>(ty))
95-
return getZeroAttr(arrTy);
92+
return cir::ZeroAttr::get(arrTy);
9693
if (auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty))
9794
return getConstNullPtrAttr(ptrTy);
9895
if (auto recordTy = mlir::dyn_cast<cir::RecordType>(ty))
99-
return getZeroAttr(recordTy);
96+
return cir::ZeroAttr::get(recordTy);
10097
if (mlir::isa<cir::BoolType>(ty)) {
101-
return getCIRBoolAttr(false);
98+
return getFalseAttr();
10299
}
103100
llvm_unreachable("Zero initializer for given type is NYI");
104101
}
105102

106103
cir::ConstantOp getBool(bool state, mlir::Location loc) {
107-
return create<cir::ConstantOp>(loc, getBoolTy(), getCIRBoolAttr(state));
104+
return create<cir::ConstantOp>(loc, getCIRBoolAttr(state));
108105
}
109106
cir::ConstantOp getFalse(mlir::Location loc) { return getBool(false, loc); }
110107
cir::ConstantOp getTrue(mlir::Location loc) { return getBool(true, loc); }
@@ -120,9 +117,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
120117
}
121118

122119
cir::BoolAttr getCIRBoolAttr(bool state) {
123-
return cir::BoolAttr::get(getContext(), getBoolTy(), state);
120+
return cir::BoolAttr::get(getContext(), state);
124121
}
125122

123+
cir::BoolAttr getTrueAttr() { return getCIRBoolAttr(true); }
124+
cir::BoolAttr getFalseAttr() { return getCIRBoolAttr(false); }
125+
126126
mlir::Value createNot(mlir::Value value) {
127127
return create<cir::UnaryOp>(value.getLoc(), value.getType(),
128128
cir::UnaryOpKind::Not, value);

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
4949
"", "cir::BoolType">:$type,
5050
"bool":$value);
5151

52+
let builders = [
53+
AttrBuilder<(ins "bool":$value), [{
54+
return $_get($_ctxt, cir::BoolType::get($_ctxt), value);
55+
}]>,
56+
];
57+
5258
let assemblyFormat = [{
5359
`<` $value `>`
5460
}];
@@ -65,6 +71,13 @@ def ZeroAttr : CIR_Attr<"Zero", "zero", [TypedAttrInterface]> {
6571
}];
6672

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

@@ -80,6 +93,13 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
8093
}];
8194

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

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,7 @@ 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

297294
let assemblyFormat = "attr-dict $value";
@@ -844,7 +841,7 @@ def UnaryOp : CIR_Op<"unary", [Pure, SameOperandsAndResultType]> {
844841
let assemblyFormat = [{
845842
`(` $kind `,` $input `)`
846843
(`nsw` $no_signed_wrap^)?
847-
`:` type($input) `,` type($result) attr-dict
844+
`:` type($input) `,` type($result) attr-dict
848845
}];
849846

850847
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)