Skip to content

Commit 766e085

Browse files
authored
Merge branch 'llvm:main' into main
2 parents 36bdf3e + 51628fa commit 766e085

File tree

479 files changed

+18445
-5564
lines changed

Some content is hidden

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

479 files changed

+18445
-5564
lines changed

clang/docs/ClangLinkerWrapper.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@ only for the linker wrapper will be forwarded to the wrapped linker job.
3030
USAGE: clang-linker-wrapper [options] -- <options to passed to the linker>
3131
3232
OPTIONS:
33-
--bitcode-library=<kind>-<triple>-<arch>=<path>
34-
Extra bitcode library to link
3533
--cuda-path=<dir> Set the system CUDA path
3634
--device-debug Use debugging
3735
--device-linker=<value> or <triple>=<value>
3836
Arguments to pass to the device linker invocation
3937
--dry-run Print program arguments without running
40-
--embed-bitcode Embed linked bitcode in the module
4138
--help-hidden Display all available options
4239
--help Display available options (--help-hidden for more)
4340
--host-triple=<triple> Triple to use for the host compilation

clang/docs/RealtimeSanitizer.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ RealtimeSanitizer (a.k.a. RTSan) is a real-time safety testing tool for C and C+
1111
projects. RTSan can be used to detect real-time violations, i.e. calls to methods
1212
that are not safe for use in functions with deterministic run time requirements.
1313
RTSan considers any function marked with the ``[[clang::nonblocking]]`` attribute
14-
to be a real-time function. If RTSan detects a call to ``malloc``, ``free``,
15-
``pthread_mutex_lock``, or anything else that could have a non-deterministic
16-
execution time in a function marked ``[[clang::nonblocking]]``
14+
to be a real-time function. At run-time, if RTSan detects a call to ``malloc``,
15+
``free``, ``pthread_mutex_lock``, or anything else that could have a
16+
non-deterministic execution time in a function marked ``[[clang::nonblocking]]``
1717
RTSan raises an error.
1818

19+
RTSan performs its analysis at run-time but shares the ``[[clang::nonblocking]]``
20+
attribute with the :doc:`FunctionEffectAnalysis` system, which operates at
21+
compile-time to detect potential real-time safety violations. For comprehensive
22+
detection of real-time safety issues, it is recommended to use both systems together.
23+
1924
The runtime slowdown introduced by RealtimeSanitizer is negligible.
2025

2126
How to build

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ AST Matchers
745745

746746
- Fixed a crash when traverse lambda expr with invalid captures. (#GH106444)
747747

748+
- Fixed ``isInstantiated`` and ``isInTemplateInstantiation`` to also match for variable templates. (#GH110666)
749+
748750
- Ensure ``hasName`` matches template specializations across inline namespaces,
749751
making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent.
750752

clang/docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Using Clang Tools
9393
ClangCheck
9494
ClangFormat
9595
ClangFormatStyleOptions
96-
ClangFormattedStatus
9796
ClangLinkerWrapper
9897
ClangNVLinkWrapper
9998
ClangOffloadBundler

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6750,7 +6750,8 @@ AST_POLYMORPHIC_MATCHER(isTemplateInstantiation,
67506750
/// matches 'A(int) {...};' and 'A(unsigned) {...}'.
67516751
AST_MATCHER_FUNCTION(internal::Matcher<Decl>, isInstantiated) {
67526752
auto IsInstantiation = decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
6753-
functionDecl(isTemplateInstantiation())));
6753+
functionDecl(isTemplateInstantiation()),
6754+
varDecl(isTemplateInstantiation())));
67546755
return decl(anyOf(IsInstantiation, hasAncestor(IsInstantiation)));
67556756
}
67566757

@@ -6769,9 +6770,9 @@ AST_MATCHER_FUNCTION(internal::Matcher<Decl>, isInstantiated) {
67696770
/// will NOT match j += 42; as it's shared between the template definition and
67706771
/// instantiation.
67716772
AST_MATCHER_FUNCTION(internal::Matcher<Stmt>, isInTemplateInstantiation) {
6772-
return stmt(
6773-
hasAncestor(decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
6774-
functionDecl(isTemplateInstantiation())))));
6773+
return stmt(hasAncestor(decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
6774+
functionDecl(isTemplateInstantiation()),
6775+
varDecl(isTemplateInstantiation())))));
67756776
}
67766777

67776778
/// Matches explicit template specializations of function, class, or

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ class CXXNameMangler {
468468
void mangleLambdaSig(const CXXRecordDecl *Lambda);
469469
void mangleModuleNamePrefix(StringRef Name, bool IsPartition = false);
470470
void mangleVendorQualifier(StringRef Name);
471+
void mangleVendorType(StringRef Name);
471472

472473
private:
473474

@@ -2891,6 +2892,10 @@ void CXXNameMangler::mangleVendorQualifier(StringRef name) {
28912892
Out << 'U' << name.size() << name;
28922893
}
28932894

2895+
void CXXNameMangler::mangleVendorType(StringRef name) {
2896+
Out << 'u' << name.size() << name;
2897+
}
2898+
28942899
void CXXNameMangler::mangleRefQualifier(RefQualifierKind RefQualifier) {
28952900
// <ref-qualifier> ::= R # lvalue reference
28962901
// ::= O # rvalue-reference
@@ -3413,8 +3418,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
34133418
if (T->getKind() == BuiltinType::SveBFloat16 && \
34143419
isCompatibleWith(LangOptions::ClangABI::Ver17)) { \
34153420
/* Prior to Clang 18.0 we used this incorrect mangled name */ \
3416-
type_name = "__SVBFloat16_t"; \
3417-
Out << "u" << type_name.size() << type_name; \
3421+
mangleVendorType("__SVBFloat16_t"); \
34183422
} else { \
34193423
type_name = MangledName; \
34203424
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
@@ -3436,35 +3440,30 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
34363440
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
34373441
break;
34383442
#include "clang/Basic/AArch64SVEACLETypes.def"
3439-
#define PPC_VECTOR_TYPE(Name, Id, Size) \
3440-
case BuiltinType::Id: \
3441-
type_name = #Name; \
3442-
Out << 'u' << type_name.size() << type_name; \
3443+
#define PPC_VECTOR_TYPE(Name, Id, Size) \
3444+
case BuiltinType::Id: \
3445+
mangleVendorType(#Name); \
34433446
break;
34443447
#include "clang/Basic/PPCTypes.def"
34453448
// TODO: Check the mangling scheme for RISC-V V.
34463449
#define RVV_TYPE(Name, Id, SingletonId) \
34473450
case BuiltinType::Id: \
3448-
type_name = Name; \
3449-
Out << 'u' << type_name.size() << type_name; \
3451+
mangleVendorType(Name); \
34503452
break;
34513453
#include "clang/Basic/RISCVVTypes.def"
34523454
#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \
34533455
case BuiltinType::Id: \
3454-
type_name = MangledName; \
3455-
Out << 'u' << type_name.size() << type_name; \
3456+
mangleVendorType(MangledName); \
34563457
break;
34573458
#include "clang/Basic/WebAssemblyReferenceTypes.def"
34583459
#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
34593460
case BuiltinType::Id: \
3460-
type_name = Name; \
3461-
Out << 'u' << type_name.size() << type_name; \
3461+
mangleVendorType(Name); \
34623462
break;
34633463
#include "clang/Basic/AMDGPUTypes.def"
34643464
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
34653465
case BuiltinType::Id: \
3466-
type_name = #Name; \
3467-
Out << 'u' << type_name.size() << type_name; \
3466+
mangleVendorType(#Name); \
34683467
break;
34693468
#include "clang/Basic/HLSLIntangibleTypes.def"
34703469
}
@@ -4035,8 +4034,9 @@ void CXXNameMangler::mangleAArch64FixedSveVectorType(const VectorType *T) {
40354034
if (T->getVectorKind() == VectorKind::SveFixedLengthPredicate)
40364035
VecSizeInBits *= 8;
40374036

4038-
Out << "9__SVE_VLSI" << 'u' << TypeName.size() << TypeName << "Lj"
4039-
<< VecSizeInBits << "EE";
4037+
Out << "9__SVE_VLSI";
4038+
mangleVendorType(TypeName);
4039+
Out << "Lj" << VecSizeInBits << "EE";
40404040
}
40414041

40424042
void CXXNameMangler::mangleAArch64FixedSveVectorType(
@@ -4136,8 +4136,9 @@ void CXXNameMangler::mangleRISCVFixedRVVVectorType(const VectorType *T) {
41364136
}
41374137
TypeNameOS << "_t";
41384138

4139-
Out << "9__RVV_VLSI" << 'u' << TypeNameStr.size() << TypeNameStr << "Lj"
4140-
<< VecSizeInBits << "EE";
4139+
Out << "9__RVV_VLSI";
4140+
mangleVendorType(TypeNameStr);
4141+
Out << "Lj" << VecSizeInBits << "EE";
41414142
}
41424143

41434144
void CXXNameMangler::mangleRISCVFixedRVVVectorType(
@@ -4236,8 +4237,7 @@ void CXXNameMangler::mangleType(const ConstantMatrixType *T) {
42364237
// Mangle matrix types as a vendor extended type:
42374238
// u<Len>matrix_typeI<Rows><Columns><element type>E
42384239

4239-
StringRef VendorQualifier = "matrix_type";
4240-
Out << "u" << VendorQualifier.size() << VendorQualifier;
4240+
mangleVendorType("matrix_type");
42414241

42424242
Out << "I";
42434243
auto &ASTCtx = getASTContext();
@@ -4255,8 +4255,7 @@ void CXXNameMangler::mangleType(const ConstantMatrixType *T) {
42554255
void CXXNameMangler::mangleType(const DependentSizedMatrixType *T) {
42564256
// Mangle matrix types as a vendor extended type:
42574257
// u<Len>matrix_typeI<row expr><column expr><element type>E
4258-
StringRef VendorQualifier = "matrix_type";
4259-
Out << "u" << VendorQualifier.size() << VendorQualifier;
4258+
mangleVendorType("matrix_type");
42604259

42614260
Out << "I";
42624261
mangleTemplateArgExpr(T->getRowExpr());
@@ -4302,7 +4301,7 @@ void CXXNameMangler::mangleType(const ObjCObjectType *T) {
43024301
StringRef name = I->getName();
43034302
QualOS << name.size() << name;
43044303
}
4305-
Out << 'U' << QualStr.size() << QualStr;
4304+
mangleVendorQualifier(QualStr);
43064305
}
43074306

43084307
mangleType(T->getBaseType());
@@ -4436,8 +4435,6 @@ void CXXNameMangler::mangleType(const UnaryTransformType *T) {
44364435
// If this is dependent, we need to record that. If not, we simply
44374436
// mangle it as the underlying type since they are equivalent.
44384437
if (T->isDependentType()) {
4439-
Out << "u";
4440-
44414438
StringRef BuiltinName;
44424439
switch (T->getUTTKind()) {
44434440
#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
@@ -4446,7 +4443,7 @@ void CXXNameMangler::mangleType(const UnaryTransformType *T) {
44464443
break;
44474444
#include "clang/Basic/TransformTypeTraits.def"
44484445
}
4449-
Out << BuiltinName.size() << BuiltinName;
4446+
mangleVendorType(BuiltinName);
44504447
}
44514448

44524449
Out << "I";
@@ -5311,9 +5308,8 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity,
53115308
// <expression> ::= u <source-name> <template-arg>* E # vendor extension
53125309
const TypeTraitExpr *TTE = cast<TypeTraitExpr>(E);
53135310
NotPrimaryExpr();
5314-
Out << 'u';
53155311
llvm::StringRef Spelling = getTraitSpelling(TTE->getTrait());
5316-
Out << Spelling.size() << Spelling;
5312+
mangleVendorType(Spelling);
53175313
for (TypeSourceInfo *TSI : TTE->getArgs()) {
53185314
mangleType(TSI->getType());
53195315
}

0 commit comments

Comments
 (0)