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)

0 commit comments

Comments
 (0)