Skip to content

Commit 4ad782b

Browse files
authored
Merge branch 'main' into coro-suspend-labels-2
2 parents 24b3c1f + ba9c262 commit 4ad782b

File tree

608 files changed

+57199
-48774
lines changed

Some content is hidden

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

608 files changed

+57199
-48774
lines changed

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,17 @@ static llvm::Error addReference(T I, Reference &&R, FieldId F) {
569569
"invalid type cannot contain Reference");
570570
}
571571

572+
template <> llvm::Error addReference(VarInfo *I, Reference &&R, FieldId F) {
573+
switch (F) {
574+
case FieldId::F_namespace:
575+
I->Namespace.emplace_back(std::move(R));
576+
return llvm::Error::success();
577+
default:
578+
return llvm::createStringError(llvm::inconvertibleErrorCode(),
579+
"VarInfo cannot contain this Reference");
580+
}
581+
}
582+
572583
template <> llvm::Error addReference(TypeInfo *I, Reference &&R, FieldId F) {
573584
switch (F) {
574585
case FieldId::F_type:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: rm -rf %t && mkdir -p %t
2+
// RUN: clang-doc --output=%t --format=json --executor=standalone %s
3+
// RUN: FileCheck %s < %t/nested/index.json --check-prefix=NESTED
4+
// RUN: FileCheck %s < %t/nested/inner/index.json --check-prefix=INNER
5+
6+
namespace nested {
7+
int Global;
8+
namespace inner {
9+
int InnerGlobal;
10+
} // namespace inner
11+
} // namespace nested
12+
13+
// NESTED: "Variables": [
14+
// NESTED-NEXT: {
15+
// NESTED-NEXT: "IsStatic": false,
16+
// NESTED-NEXT: "Location": {
17+
// NESTED-NEXT: "Filename": "{{.*}}nested-namespace.cpp",
18+
// NESTED-NEXT: "LineNumber": 7
19+
// NESTED-NEXT: },
20+
// NESTED-NEXT: "Name": "Global",
21+
// NESTED-NEXT: "Namespace": [
22+
// NESTED-NEXT: "nested"
23+
// NESTED-NEXT: ],
24+
25+
// INNER: "Variables": [
26+
// INNER-NEXT: {
27+
// INNER-NEXT: "IsStatic": false,
28+
// INNER-NEXT: "Location": {
29+
// INNER-NEXT: "Filename": "{{.*}}nested-namespace.cpp",
30+
// INNER-NEXT: "LineNumber": 9
31+
// INNER-NEXT: },
32+
// INNER-NEXT: "Name": "InnerGlobal",
33+
// INNER-NEXT: "Namespace": [
34+
// INNER-NEXT: "inner",
35+
// INNER-NEXT: "nested"
36+
// INNER-NEXT: ],

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ Improvements to Clang's diagnostics
661661
diagnostics when floating-point numbers had both width field and plus or space
662662
prefix specified. (#GH143951)
663663

664+
- A warning is now emitted when ``main`` is attached to a named module,
665+
which can be turned off with ``-Wno-main-attached-to-named-module``. (#GH146247)
666+
664667
- Clang now avoids issuing `-Wreturn-type` warnings in some cases where
665668
the final statement of a non-void function is a `throw` expression, or
666669
a call to a function that is trivially known to always throw (i.e., its
@@ -969,6 +972,8 @@ Arm and AArch64 Support
969972

970973
- For AArch64, added support for generating executable-only code sections by using the
971974
``-mexecute-only`` or ``-mpure-code`` compiler flags. (#GH125688)
975+
- Added ``-msve-streaming-vector-bits=`` flag, which allows specifying the
976+
SVE vector width in streaming mode.
972977

973978
Android Support
974979
^^^^^^^^^^^^^^^

clang/include/clang/AST/Decl.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,17 @@ struct EvaluatedStmt {
888888
bool HasICEInit : 1;
889889
bool CheckedForICEInit : 1;
890890

891+
bool HasSideEffects : 1;
892+
bool CheckedForSideEffects : 1;
893+
891894
LazyDeclStmtPtr Value;
892895
APValue Evaluated;
893896

894897
EvaluatedStmt()
895898
: WasEvaluated(false), IsEvaluating(false),
896899
HasConstantInitialization(false), HasConstantDestruction(false),
897-
HasICEInit(false), CheckedForICEInit(false) {}
900+
HasICEInit(false), CheckedForICEInit(false), HasSideEffects(false),
901+
CheckedForSideEffects(false) {}
898902
};
899903

900904
/// Represents a variable declaration or definition.
@@ -1353,9 +1357,11 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
13531357
return const_cast<VarDecl *>(this)->getInitializingDeclaration();
13541358
}
13551359

1356-
/// Checks whether this declaration has an initializer with side effects,
1357-
/// without triggering deserialization if the initializer is not yet
1358-
/// deserialized.
1360+
/// Checks whether this declaration has an initializer with side effects.
1361+
/// The result is cached. If the result hasn't been computed this can trigger
1362+
/// deserialization and constant evaluation. By running this during
1363+
/// serialization and serializing the result all clients can safely call this
1364+
/// without triggering further deserialization.
13591365
bool hasInitWithSideEffects() const;
13601366

13611367
/// Determine whether this variable's value might be usable in a

clang/include/clang/AST/ExternalASTSource.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
196196
/// module.
197197
virtual bool wasThisDeclarationADefinition(const FunctionDecl *FD);
198198

199-
virtual bool hasInitializerWithSideEffects(const VarDecl *VD) const {
200-
return false;
201-
}
202-
203199
/// Finds all declarations lexically contained within the given
204200
/// DeclContext, after applying an optional filter predicate.
205201
///
@@ -434,17 +430,6 @@ struct LazyOffsetPtr {
434430
return GetPtr();
435431
}
436432

437-
/// Retrieve the pointer to the AST node that this lazy pointer points to,
438-
/// if it can be done without triggering deserialization.
439-
///
440-
/// \returns a pointer to the AST node, or null if not yet deserialized.
441-
T *getWithoutDeserializing() const {
442-
if (isOffset()) {
443-
return nullptr;
444-
}
445-
return GetPtr();
446-
}
447-
448433
/// Retrieve the address of the AST node pointer. Deserializes the pointee if
449434
/// necessary.
450435
T **getAddressOfPointer(ExternalASTSource *Source) const {

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,11 @@ TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_f16_f32, "V2hV2hfUiIb", "nc", "f32-to-f16
640640
// GFX1250+ only builtins.
641641
//===----------------------------------------------------------------------===//
642642

643+
TARGET_BUILTIN(__builtin_amdgcn_tensor_load_to_lds, "vV4iV8iV4iV4iIi", "nc", "gfx1250-insts")
644+
TARGET_BUILTIN(__builtin_amdgcn_tensor_load_to_lds_d2, "vV4iV8iIi", "nc", "gfx1250-insts")
645+
TARGET_BUILTIN(__builtin_amdgcn_tensor_store_from_lds, "vV4iV8iV4iV4iIi", "nc", "gfx1250-insts")
646+
TARGET_BUILTIN(__builtin_amdgcn_tensor_store_from_lds_d2, "vV4iV8iIi", "nc", "gfx1250-insts")
647+
643648
TARGET_BUILTIN(__builtin_amdgcn_global_load_tr4_b64_v2i32, "V2iV2i*1", "nc", "transpose-load-f4f6-insts,wavefrontsize32")
644649
TARGET_BUILTIN(__builtin_amdgcn_global_load_tr8_b64_v2i32, "V2iV2i*1", "nc", "gfx1250-insts,wavefrontsize32")
645650
TARGET_BUILTIN(__builtin_amdgcn_global_load_tr6_b96_v3i32, "V3iV3i*1", "nc", "transpose-load-f4f6-insts,wavefrontsize32")

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,9 @@ def err_constexpr_main : Error<
10621062
"'main' is not allowed to be declared %select{constexpr|consteval}0">;
10631063
def err_deleted_main : Error<"'main' is not allowed to be deleted">;
10641064
def err_mainlike_template_decl : Error<"%0 cannot be a template">;
1065+
def warn_main_in_named_module
1066+
: ExtWarn<"'main' never has module linkage">,
1067+
InGroup<DiagGroup<"main-attached-to-named-module">>;
10651068
def err_main_returns_nonint : Error<"'main' must return 'int'">;
10661069
def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
10671070
InGroup<MainReturnType>;
@@ -3329,6 +3332,9 @@ def err_sve_vector_in_non_sve_target : Error<
33293332
"SVE vector type %0 cannot be used in a target without sve">;
33303333
def err_sve_vector_in_non_streaming_function : Error<
33313334
"SVE vector type %0 cannot be used in a non-streaming function">;
3335+
def err_sve_fixed_vector_in_streaming_function
3336+
: Error<"fixed width SVE vector type %0 cannot be used in a "
3337+
"%select{streaming|streaming-compatible}1 function">;
33323338
def err_attribute_riscv_rvv_bits_unsupported : Error<
33333339
"%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
33343340
"value of \"zvl\" or a power 2 in the range [64,65536]">;
@@ -13214,8 +13220,12 @@ def err_acc_not_a_var_ref_use_device_declare
1321413220
: Error<"OpenACC variable %select{in 'use_device' clause|on 'declare' "
1321513221
"construct}0 is not a valid variable name or array name">;
1321613222
def err_acc_not_a_var_ref_cache
13217-
: Error<"OpenACC variable in cache directive is not a valid sub-array or "
13223+
: Error<"OpenACC variable in 'cache' directive is not a valid sub-array or "
1321813224
"array element">;
13225+
def warn_acc_cache_var_not_outside_loop
13226+
: Warning<"OpenACC variable in 'cache' directive was not declared outside "
13227+
"of the associated 'loop' directive; directive has no effect">,
13228+
InGroup<DiagGroup<"openacc-cache-var-inside-loop">>;
1321913229
def err_acc_typecheck_subarray_value
1322013230
: Error<"OpenACC sub-array subscripted value is not an array or pointer">;
1322113231
def err_acc_subarray_function_type

clang/include/clang/Basic/LangOptions.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ LANGOPT(OmitVTableRTTI, 1, 0,
503503
LANGOPT(VScaleMin, 32, 0, "Minimum vscale value")
504504
LANGOPT(VScaleMax, 32, 0, "Maximum vscale value")
505505

506+
LANGOPT(VScaleStreamingMin, 32, 0, "Minimum streaming vscale value")
507+
LANGOPT(VScaleStreamingMax, 32, 0, "Maximum streaming vscale value")
508+
506509
ENUM_LANGOPT(ExtendIntArgs, ExtendArgsKind, 1, ExtendArgsKind::ExtendTo32,
507510
"Controls how scalar integer arguments are extended in calls "
508511
"to unprototyped and varargs functions")

clang/include/clang/Basic/TargetInfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,15 @@ class TargetInfo : public TransferrableTargetInfo,
10341034
/// set of primary and secondary targets.
10351035
virtual llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const = 0;
10361036

1037+
enum class ArmStreamingKind {
1038+
NotStreaming,
1039+
StreamingCompatible,
1040+
Streaming,
1041+
};
1042+
10371043
/// Returns target-specific min and max values VScale_Range.
10381044
virtual std::optional<std::pair<unsigned, unsigned>>
1039-
getVScaleRange(const LangOptions &LangOpts, bool IsArmStreamingFunction,
1045+
getVScaleRange(const LangOptions &LangOpts, ArmStreamingKind Mode,
10401046
llvm::StringMap<bool> *FeatureMap = nullptr) const {
10411047
return std::nullopt;
10421048
}

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,25 +228,28 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
228228

229229
cir::CallOp createCallOp(mlir::Location loc, mlir::SymbolRefAttr callee,
230230
mlir::Type returnType, mlir::ValueRange operands,
231-
cir::SideEffect sideEffect = cir::SideEffect::All) {
232-
return create<cir::CallOp>(loc, callee, returnType, operands, sideEffect);
231+
llvm::ArrayRef<mlir::NamedAttribute> attrs = {}) {
232+
auto op = create<cir::CallOp>(loc, callee, returnType, operands);
233+
op->setAttrs(attrs);
234+
return op;
233235
}
234236

235237
cir::CallOp createCallOp(mlir::Location loc, cir::FuncOp callee,
236238
mlir::ValueRange operands,
237-
cir::SideEffect sideEffect = cir::SideEffect::All) {
239+
llvm::ArrayRef<mlir::NamedAttribute> attrs = {}) {
238240
return createCallOp(loc, mlir::SymbolRefAttr::get(callee),
239241
callee.getFunctionType().getReturnType(), operands,
240-
sideEffect);
242+
attrs);
241243
}
242244

243-
cir::CallOp createIndirectCallOp(mlir::Location loc,
244-
mlir::Value indirectTarget,
245-
cir::FuncType funcType,
246-
mlir::ValueRange operands,
247-
cir::SideEffect sideEffect) {
248-
return create<cir::CallOp>(loc, indirectTarget, funcType.getReturnType(),
249-
operands, sideEffect);
245+
cir::CallOp
246+
createIndirectCallOp(mlir::Location loc, mlir::Value indirectTarget,
247+
cir::FuncType funcType, mlir::ValueRange operands,
248+
llvm::ArrayRef<mlir::NamedAttribute> attrs = {}) {
249+
llvm::SmallVector<mlir::Value> resOperands{indirectTarget};
250+
resOperands.append(operands.begin(), operands.end());
251+
return createCallOp(loc, mlir::SymbolRefAttr(), funcType.getReturnType(),
252+
resOperands, attrs);
250253
}
251254

252255
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)