Skip to content

Commit 42aaf55

Browse files
committed
Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde. PR: 276104 MFC after: 1 month
2 parents c8faa43 + aca2e42 commit 42aaf55

File tree

686 files changed

+13943
-6422
lines changed

Some content is hidden

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

686 files changed

+13943
-6422
lines changed

contrib/llvm-project/clang/include/clang/AST/Attr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "clang/Basic/Sanitizers.h"
2626
#include "clang/Basic/SourceLocation.h"
2727
#include "llvm/Frontend/HLSL/HLSLResource.h"
28+
#include "llvm/Support/CodeGen.h"
2829
#include "llvm/Support/ErrorHandling.h"
2930
#include "llvm/Support/VersionTuple.h"
3031
#include "llvm/Support/raw_ostream.h"

contrib/llvm-project/clang/include/clang/AST/DeclCXX.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,14 @@ class RequiresExprBodyDecl : public Decl, public DeclContext {
20442044
// Implement isa/cast/dyncast/etc.
20452045
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
20462046
static bool classofKind(Kind K) { return K == RequiresExprBody; }
2047+
2048+
static DeclContext *castToDeclContext(const RequiresExprBodyDecl *D) {
2049+
return static_cast<DeclContext *>(const_cast<RequiresExprBodyDecl *>(D));
2050+
}
2051+
2052+
static RequiresExprBodyDecl *castFromDeclContext(const DeclContext *DC) {
2053+
return static_cast<RequiresExprBodyDecl *>(const_cast<DeclContext *>(DC));
2054+
}
20472055
};
20482056

20492057
/// Represents a static or instance method of a struct/union/class.

contrib/llvm-project/clang/include/clang/AST/TextNodeDumper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ class TextNodeDumper
252252
void VisitGotoStmt(const GotoStmt *Node);
253253
void VisitCaseStmt(const CaseStmt *Node);
254254
void VisitReturnStmt(const ReturnStmt *Node);
255+
void VisitCoawaitExpr(const CoawaitExpr *Node);
256+
void VisitCoreturnStmt(const CoreturnStmt *Node);
255257
void VisitCompoundStmt(const CompoundStmt *Node);
256258
void VisitConstantExpr(const ConstantExpr *Node);
257259
void VisitCallExpr(const CallExpr *Node);

contrib/llvm-project/clang/include/clang/AST/Type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,6 +4224,8 @@ class FunctionProtoType final
42244224
ExceptionSpecInfo() = default;
42254225

42264226
ExceptionSpecInfo(ExceptionSpecificationType EST) : Type(EST) {}
4227+
4228+
void instantiate();
42274229
};
42284230

42294231
/// Extra information about a function prototype. ExtProtoInfo is not

contrib/llvm-project/clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class UnsafeBufferUsageHandler {
6666

6767
/// Invoked when an unsafe operation over raw pointers is found.
6868
virtual void handleUnsafeOperation(const Stmt *Operation,
69-
bool IsRelatedToDecl) = 0;
69+
bool IsRelatedToDecl, ASTContext &Ctx) = 0;
7070

7171
/// Invoked when a fix is suggested against a variable. This function groups
7272
/// all variables that must be fixed together (i.e their types must be changed

contrib/llvm-project/clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ WARNING_GADGET(Decrement)
3030
WARNING_GADGET(ArraySubscript)
3131
WARNING_GADGET(PointerArithmetic)
3232
WARNING_GADGET(UnsafeBufferUsageAttr)
33+
WARNING_GADGET(DataInvocation)
3334
FIXABLE_GADGET(ULCArraySubscript) // `DRE[any]` in an Unspecified Lvalue Context
3435
FIXABLE_GADGET(DerefSimplePtrArithFixable)
3536
FIXABLE_GADGET(PointerDereference)

contrib/llvm-project/clang/include/clang/Analysis/CFG.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,9 @@ class CFG {
12151215
//===--------------------------------------------------------------------===//
12161216

12171217
class BuildOptions {
1218-
std::bitset<Stmt::lastStmtConstant> alwaysAddMask;
1218+
// Stmt::lastStmtConstant has the same value as the last Stmt kind,
1219+
// so make sure we add one to account for this!
1220+
std::bitset<Stmt::lastStmtConstant + 1> alwaysAddMask;
12191221

12201222
public:
12211223
using ForcedBlkExprs = llvm::DenseMap<const Stmt *, const CFGBlock *>;

contrib/llvm-project/clang/include/clang/Basic/Attr.td

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ def ExternalGlobalVar : SubsetSubject<Var,
143143
!S->isLocalExternDecl()}],
144144
"external global variables">;
145145

146+
def NonTLSGlobalVar : SubsetSubject<Var,
147+
[{S->hasGlobalStorage() &&
148+
S->getTLSKind() == 0}],
149+
"non-TLS global variables">;
150+
146151
def InlineFunction : SubsetSubject<Function,
147152
[{S->isInlineSpecified()}], "inline functions">;
148153

@@ -431,6 +436,7 @@ def TargetAArch64 : TargetArch<["aarch64", "aarch64_be", "aarch64_32"]>;
431436
def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
432437
def TargetAVR : TargetArch<["avr"]>;
433438
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
439+
def TargetLoongArch : TargetArch<["loongarch32", "loongarch64"]>;
434440
def TargetMips32 : TargetArch<["mips", "mipsel"]>;
435441
def TargetAnyMips : TargetArch<["mips", "mipsel", "mips64", "mips64el"]>;
436442
def TargetMSP430 : TargetArch<["msp430"]>;
@@ -1121,6 +1127,14 @@ def CoroLifetimeBound : InheritableAttr {
11211127
let SimpleHandler = 1;
11221128
}
11231129

1130+
def CoroDisableLifetimeBound : InheritableAttr {
1131+
let Spellings = [Clang<"coro_disable_lifetimebound">];
1132+
let Subjects = SubjectList<[Function]>;
1133+
let LangOpts = [CPlusPlus];
1134+
let Documentation = [CoroLifetimeBoundDoc];
1135+
let SimpleHandler = 1;
1136+
}
1137+
11241138
// OSObject-based attributes.
11251139
def OSConsumed : InheritableParamAttr {
11261140
let Spellings = [Clang<"os_consumed">];
@@ -2730,6 +2744,15 @@ def PragmaClangTextSection : InheritableAttr {
27302744
let Documentation = [InternalOnly];
27312745
}
27322746

2747+
def CodeModel : InheritableAttr, TargetSpecificAttr<TargetLoongArch> {
2748+
let Spellings = [GCC<"model">];
2749+
let Args = [EnumArgument<"Model", "llvm::CodeModel::Model",
2750+
["normal", "medium", "extreme"], ["Small", "Medium", "Large"],
2751+
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1>];
2752+
let Subjects = SubjectList<[NonTLSGlobalVar], ErrorDiag>;
2753+
let Documentation = [CodeModelDocs];
2754+
}
2755+
27332756
def Sentinel : InheritableAttr {
27342757
let Spellings = [GCC<"sentinel">];
27352758
let Args = [DefaultIntArgument<"Sentinel", 0>,

contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ global variable or function should be in after translation.
5757
let Heading = "section, __declspec(allocate)";
5858
}
5959

60+
def CodeModelDocs : Documentation {
61+
let Category = DocCatVariable;
62+
let Content = [{
63+
The ``model`` attribute allows overriding the translation unit's
64+
code model (specified by ``-mcmodel``) for a specific global variable.
65+
}];
66+
let Heading = "model";
67+
}
68+
6069
def UsedDocs : Documentation {
6170
let Category = DocCatFunction;
6271
let Content = [{
@@ -7671,9 +7680,12 @@ The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied
76717680
to a coroutine return type (`CRT`_) (i.e.
76727681
it should also be annotated with ``[[clang::coro_return_type]]``).
76737682

7674-
All parameters of a function are considered to be lifetime bound. See `documentation`_
7675-
of ``[[clang::lifetimebound]]`` for more details.
7676-
if the function returns a coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``.
7683+
All parameters of a function are considered to be lifetime bound if the function returns a
7684+
coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``.
7685+
This lifetime bound analysis can be disabled for a coroutine wrapper or a coroutine by annotating the function
7686+
with ``[[clang::coro_disable_lifetimebound]]`` function attribute .
7687+
See `documentation`_ of ``[[clang::lifetimebound]]`` for details about lifetime bound analysis.
7688+
76777689

76787690
Reference parameters of a coroutine are susceptible to capturing references to temporaries or local variables.
76797691

@@ -7703,7 +7715,7 @@ Both coroutines and coroutine wrappers are part of this analysis.
77037715
};
77047716

77057717
Task<int> coro(const int& a) { co_return a + 1; }
7706-
Task<int> [[clang::coro_wrapper]] coro_wrapper(const int& a, const int& b) {
7718+
[[clang::coro_wrapper]] Task<int> coro_wrapper(const int& a, const int& b) {
77077719
return a > b ? coro(a) : coro(b);
77087720
}
77097721
Task<int> temporary_reference() {
@@ -7718,6 +7730,21 @@ Both coroutines and coroutine wrappers are part of this analysis.
77187730
return coro(a); // warning: returning address of stack variable `a`.
77197731
}
77207732

7733+
This analysis can be disabled for all calls to a particular function by annotating the function
7734+
with function attribute ``[[clang::coro_disable_lifetimebound]]``.
7735+
For example, this could be useful for coroutine wrappers which accept reference parameters
7736+
but do not pass them to the underlying coroutine or pass them by value.
7737+
7738+
.. code-block:: c++
7739+
7740+
Task<int> coro(int a) { co_return a + 1; }
7741+
[[clang::coro_wrapper, clang::coro_disable_lifetimebound]] Task<int> coro_wrapper(const int& a) {
7742+
return coro(a + 1);
7743+
}
7744+
void use() {
7745+
auto task = coro_wrapper(1); // use of temporary is fine as the argument is not lifetime bound.
7746+
}
7747+
77217748
.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
77227749
.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
77237750
}];

contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ CODEGENOPT(CoverageMapping , 1, 0) ///< Generate coverage mapping regions to
209209
///< enable code coverage analysis.
210210
CODEGENOPT(DumpCoverageMapping , 1, 0) ///< Dump the generated coverage mapping
211211
///< regions.
212+
CODEGENOPT(MCDCCoverage , 1, 0) ///< Enable MC/DC code coverage criteria.
212213

213214
/// If -fpcc-struct-return or -freg-struct-return is specified.
214215
ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Default)

contrib/llvm-project/clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ def warn_invalid_feature_combination : Warning<
349349
def warn_target_unrecognized_env : Warning<
350350
"mismatch between architecture and environment in target triple '%0'; did you mean '%1'?">,
351351
InGroup<InvalidCommandLineArgument>;
352+
def warn_knl_knm_isa_support_removed : Warning<
353+
"KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.">,
354+
InGroup<DiagGroup<"knl-knm-isa-support-removed">>;
352355

353356
// Source manager
354357
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;

contrib/llvm-project/clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,4 +786,7 @@ def warn_android_unversioned_fallback : Warning<
786786
" directories will not be used in Clang 19. Provide a versioned directory"
787787
" for the target version or lower instead.">,
788788
InGroup<DiagGroup<"android-unversioned-fallback">>;
789+
790+
def err_drv_triple_version_invalid : Error<
791+
"version '%0' in target triple '%1' is invalid">;
789792
}

contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,8 @@ def err_acc_invalid_clause : Error<"invalid OpenACC clause %0">;
13641364
def err_acc_missing_directive : Error<"expected OpenACC directive">;
13651365
def err_acc_invalid_open_paren
13661366
: Error<"expected clause-list or newline in OpenACC directive">;
1367+
def err_acc_invalid_default_clause_kind
1368+
: Error<"invalid value for 'default' clause; expected 'present' or 'none'">;
13671369

13681370
// OpenMP support.
13691371
def warn_pragma_omp_ignored : Warning<

contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,6 +3415,8 @@ def warn_objc_redundant_literal_use : Warning<
34153415
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
34163416
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
34173417

3418+
def err_attr_codemodel_arg : Error<"code model '%0' is not supported on this target">;
3419+
34183420
def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
34193421

34203422
def err_tls_var_aligned_over_maximum : Error<
@@ -6158,23 +6160,19 @@ def err_illegal_initializer_type : Error<"illegal initializer type %0">;
61586160
def ext_init_list_type_narrowing : ExtWarn<
61596161
"type %0 cannot be narrowed to %1 in initializer list">,
61606162
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6161-
// *_narrowing_const_reference diagnostics have the same messages, but are
6162-
// controlled by -Wc++11-narrowing-const-reference for narrowing involving a
6163-
// const reference.
61646163
def ext_init_list_type_narrowing_const_reference : ExtWarn<
6165-
"type %0 cannot be narrowed to %1 in initializer list">,
6164+
ext_init_list_type_narrowing.Summary>,
61666165
InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
61676166
def ext_init_list_variable_narrowing : ExtWarn<
61686167
"non-constant-expression cannot be narrowed from type %0 to %1 in "
61696168
"initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
61706169
def ext_init_list_variable_narrowing_const_reference : ExtWarn<
6171-
"non-constant-expression cannot be narrowed from type %0 to %1 in "
6172-
"initializer list">, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6170+
ext_init_list_variable_narrowing.Summary>, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
61736171
def ext_init_list_constant_narrowing : ExtWarn<
61746172
"constant expression evaluates to %0 which cannot be narrowed to type %1">,
61756173
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
61766174
def ext_init_list_constant_narrowing_const_reference : ExtWarn<
6177-
"constant expression evaluates to %0 which cannot be narrowed to type %1">,
6175+
ext_init_list_constant_narrowing.Summary>,
61786176
InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
61796177
def warn_init_list_type_narrowing : Warning<
61806178
"type %0 cannot be narrowed to %1 in initializer list in C++11">,
@@ -12064,7 +12062,7 @@ def warn_unsafe_buffer_variable : Warning<
1206412062
InGroup<UnsafeBufferUsage>, DefaultIgnore;
1206512063
def warn_unsafe_buffer_operation : Warning<
1206612064
"%select{unsafe pointer operation|unsafe pointer arithmetic|"
12067-
"unsafe buffer access|function introduces unsafe buffer manipulation}0">,
12065+
"unsafe buffer access|function introduces unsafe buffer manipulation|unsafe invocation of span::data}0">,
1206812066
InGroup<UnsafeBufferUsage>, DefaultIgnore;
1206912067
def note_unsafe_buffer_operation : Note<
1207012068
"used%select{| in pointer arithmetic| in buffer access}0 here">;

contrib/llvm-project/clang/include/clang/Basic/ObjCRuntime.h

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,24 @@ class ObjCRuntime {
100100
bool isLegacyDispatchDefaultForArch(llvm::Triple::ArchType Arch) {
101101
// The GNUstep runtime uses a newer dispatch method by default from
102102
// version 1.6 onwards
103-
if (getKind() == GNUstep && getVersion() >= VersionTuple(1, 6)) {
104-
if (Arch == llvm::Triple::arm ||
105-
Arch == llvm::Triple::x86 ||
106-
Arch == llvm::Triple::x86_64)
107-
return false;
108-
}
109-
else if ((getKind() == MacOSX) && isNonFragile() &&
110-
(getVersion() >= VersionTuple(10, 0)) &&
111-
(getVersion() < VersionTuple(10, 6)))
112-
return Arch != llvm::Triple::x86_64;
103+
if (getKind() == GNUstep) {
104+
switch (Arch) {
105+
case llvm::Triple::arm:
106+
case llvm::Triple::x86:
107+
case llvm::Triple::x86_64:
108+
return !(getVersion() >= VersionTuple(1, 6));
109+
case llvm::Triple::aarch64:
110+
case llvm::Triple::mips64:
111+
return !(getVersion() >= VersionTuple(1, 9));
112+
case llvm::Triple::riscv64:
113+
return !(getVersion() >= VersionTuple(2, 2));
114+
default:
115+
return true;
116+
}
117+
} else if ((getKind() == MacOSX) && isNonFragile() &&
118+
(getVersion() >= VersionTuple(10, 0)) &&
119+
(getVersion() < VersionTuple(10, 6)))
120+
return Arch != llvm::Triple::x86_64;
113121
// Except for deployment target of 10.5 or less,
114122
// Mac runtimes use legacy dispatch everywhere now.
115123
return true;

contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,42 @@ enum class OpenACCAtomicKind {
7272

7373
/// Represents the kind of an OpenACC clause.
7474
enum class OpenACCClauseKind {
75-
// 'finalize' clause, allowed on 'exit data' directive.
75+
/// 'finalize' clause, allowed on 'exit data' directive.
7676
Finalize,
77-
// 'if_present' clause, allowed on 'host_data' and 'update' directives.
77+
/// 'if_present' clause, allowed on 'host_data' and 'update' directives.
7878
IfPresent,
79-
// 'seq' clause, allowed on 'loop' and 'routine' directives.
79+
/// 'seq' clause, allowed on 'loop' and 'routine' directives.
8080
Seq,
81-
// 'independent' clause, allowed on 'loop' directives.
81+
/// 'independent' clause, allowed on 'loop' directives.
8282
Independent,
83-
// 'auto' clause, allowed on 'loop' directives.
83+
/// 'auto' clause, allowed on 'loop' directives.
8484
Auto,
85-
// 'worker' clause, allowed on 'loop' and 'routine' directives.
85+
/// 'worker' clause, allowed on 'loop' and 'routine' directives.
8686
Worker,
87-
// 'vector' clause, allowed on 'loop' and 'routine' directives. Takes no
88-
// arguments for 'routine', so the 'loop' version is not yet implemented
89-
// completely.
87+
/// 'vector' clause, allowed on 'loop' and 'routine' directives. Takes no
88+
/// arguments for 'routine', so the 'loop' version is not yet implemented
89+
/// completely.
9090
Vector,
91-
// 'nohost' clause, allowed on 'routine' directives.
91+
/// 'nohost' clause, allowed on 'routine' directives.
9292
NoHost,
93-
// Represents an invalid clause, for the purposes of parsing.
93+
/// 'default' clause, allowed on parallel, serial, kernel (and compound)
94+
/// constructs.
95+
Default,
96+
/// 'if' clause, allowed on all the Compute Constructs, Data Constructs,
97+
/// Executable Constructs, and Combined Constructs.
98+
If,
99+
/// 'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
100+
Self,
101+
/// Represents an invalid clause, for the purposes of parsing.
102+
Invalid,
103+
};
104+
105+
enum class OpenACCDefaultClauseKind {
106+
/// 'none' option.
107+
None,
108+
/// 'present' option.
109+
Present,
110+
/// Not a valid option.
94111
Invalid,
95112
};
96113
} // namespace clang

0 commit comments

Comments
 (0)