Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
Created using spr 1.3.4
  • Loading branch information
ilovepi committed Oct 30, 2024
2 parents f331c70 + 6b0ae12 commit 6fec2ec
Show file tree
Hide file tree
Showing 502 changed files with 19,517 additions and 5,935 deletions.
3 changes: 0 additions & 3 deletions clang/docs/ClangLinkerWrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ only for the linker wrapper will be forwarded to the wrapped linker job.
USAGE: clang-linker-wrapper [options] -- <options to passed to the linker>
OPTIONS:
--bitcode-library=<kind>-<triple>-<arch>=<path>
Extra bitcode library to link
--cuda-path=<dir> Set the system CUDA path
--device-debug Use debugging
--device-linker=<value> or <triple>=<value>
Arguments to pass to the device linker invocation
--dry-run Print program arguments without running
--embed-bitcode Embed linked bitcode in the module
--help-hidden Display all available options
--help Display available options (--help-hidden for more)
--host-triple=<triple> Triple to use for the host compilation
Expand Down
11 changes: 8 additions & 3 deletions clang/docs/RealtimeSanitizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ RealtimeSanitizer (a.k.a. RTSan) is a real-time safety testing tool for C and C+
projects. RTSan can be used to detect real-time violations, i.e. calls to methods
that are not safe for use in functions with deterministic run time requirements.
RTSan considers any function marked with the ``[[clang::nonblocking]]`` attribute
to be a real-time function. If RTSan detects a call to ``malloc``, ``free``,
``pthread_mutex_lock``, or anything else that could have a non-deterministic
execution time in a function marked ``[[clang::nonblocking]]``
to be a real-time function. At run-time, if RTSan detects a call to ``malloc``,
``free``, ``pthread_mutex_lock``, or anything else that could have a
non-deterministic execution time in a function marked ``[[clang::nonblocking]]``
RTSan raises an error.

RTSan performs its analysis at run-time but shares the ``[[clang::nonblocking]]``
attribute with the :doc:`FunctionEffectAnalysis` system, which operates at
compile-time to detect potential real-time safety violations. For comprehensive
detection of real-time safety issues, it is recommended to use both systems together.

The runtime slowdown introduced by RealtimeSanitizer is negligible.

How to build
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ AST Matchers

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

- Fixed ``isInstantiated`` and ``isInTemplateInstantiation`` to also match for variable templates. (#GH110666)

- Ensure ``hasName`` matches template specializations across inline namespaces,
making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent.

Expand Down
1 change: 0 additions & 1 deletion clang/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ Using Clang Tools
ClangCheck
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
ClangLinkerWrapper
ClangNVLinkWrapper
ClangOffloadBundler
Expand Down
9 changes: 5 additions & 4 deletions clang/include/clang/ASTMatchers/ASTMatchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -6750,7 +6750,8 @@ AST_POLYMORPHIC_MATCHER(isTemplateInstantiation,
/// matches 'A(int) {...};' and 'A(unsigned) {...}'.
AST_MATCHER_FUNCTION(internal::Matcher<Decl>, isInstantiated) {
auto IsInstantiation = decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
functionDecl(isTemplateInstantiation())));
functionDecl(isTemplateInstantiation()),
varDecl(isTemplateInstantiation())));
return decl(anyOf(IsInstantiation, hasAncestor(IsInstantiation)));
}

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

/// Matches explicit template specializations of function, class, or
Expand Down
52 changes: 24 additions & 28 deletions clang/lib/AST/ItaniumMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ class CXXNameMangler {
void mangleLambdaSig(const CXXRecordDecl *Lambda);
void mangleModuleNamePrefix(StringRef Name, bool IsPartition = false);
void mangleVendorQualifier(StringRef Name);
void mangleVendorType(StringRef Name);

private:

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

void CXXNameMangler::mangleVendorType(StringRef name) {
Out << 'u' << name.size() << name;
}

void CXXNameMangler::mangleRefQualifier(RefQualifierKind RefQualifier) {
// <ref-qualifier> ::= R # lvalue reference
// ::= O # rvalue-reference
Expand Down Expand Up @@ -3413,8 +3418,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
if (T->getKind() == BuiltinType::SveBFloat16 && \
isCompatibleWith(LangOptions::ClangABI::Ver17)) { \
/* Prior to Clang 18.0 we used this incorrect mangled name */ \
type_name = "__SVBFloat16_t"; \
Out << "u" << type_name.size() << type_name; \
mangleVendorType("__SVBFloat16_t"); \
} else { \
type_name = MangledName; \
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
Expand All @@ -3436,35 +3440,30 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
break;
#include "clang/Basic/AArch64SVEACLETypes.def"
#define PPC_VECTOR_TYPE(Name, Id, Size) \
case BuiltinType::Id: \
type_name = #Name; \
Out << 'u' << type_name.size() << type_name; \
#define PPC_VECTOR_TYPE(Name, Id, Size) \
case BuiltinType::Id: \
mangleVendorType(#Name); \
break;
#include "clang/Basic/PPCTypes.def"
// TODO: Check the mangling scheme for RISC-V V.
#define RVV_TYPE(Name, Id, SingletonId) \
case BuiltinType::Id: \
type_name = Name; \
Out << 'u' << type_name.size() << type_name; \
mangleVendorType(Name); \
break;
#include "clang/Basic/RISCVVTypes.def"
#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \
case BuiltinType::Id: \
type_name = MangledName; \
Out << 'u' << type_name.size() << type_name; \
mangleVendorType(MangledName); \
break;
#include "clang/Basic/WebAssemblyReferenceTypes.def"
#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
case BuiltinType::Id: \
type_name = Name; \
Out << 'u' << type_name.size() << type_name; \
mangleVendorType(Name); \
break;
#include "clang/Basic/AMDGPUTypes.def"
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
case BuiltinType::Id: \
type_name = #Name; \
Out << 'u' << type_name.size() << type_name; \
mangleVendorType(#Name); \
break;
#include "clang/Basic/HLSLIntangibleTypes.def"
}
Expand Down Expand Up @@ -4035,8 +4034,9 @@ void CXXNameMangler::mangleAArch64FixedSveVectorType(const VectorType *T) {
if (T->getVectorKind() == VectorKind::SveFixedLengthPredicate)
VecSizeInBits *= 8;

Out << "9__SVE_VLSI" << 'u' << TypeName.size() << TypeName << "Lj"
<< VecSizeInBits << "EE";
Out << "9__SVE_VLSI";
mangleVendorType(TypeName);
Out << "Lj" << VecSizeInBits << "EE";
}

void CXXNameMangler::mangleAArch64FixedSveVectorType(
Expand Down Expand Up @@ -4136,8 +4136,9 @@ void CXXNameMangler::mangleRISCVFixedRVVVectorType(const VectorType *T) {
}
TypeNameOS << "_t";

Out << "9__RVV_VLSI" << 'u' << TypeNameStr.size() << TypeNameStr << "Lj"
<< VecSizeInBits << "EE";
Out << "9__RVV_VLSI";
mangleVendorType(TypeNameStr);
Out << "Lj" << VecSizeInBits << "EE";
}

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

StringRef VendorQualifier = "matrix_type";
Out << "u" << VendorQualifier.size() << VendorQualifier;
mangleVendorType("matrix_type");

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

Out << "I";
mangleTemplateArgExpr(T->getRowExpr());
Expand Down Expand Up @@ -4302,7 +4301,7 @@ void CXXNameMangler::mangleType(const ObjCObjectType *T) {
StringRef name = I->getName();
QualOS << name.size() << name;
}
Out << 'U' << QualStr.size() << QualStr;
mangleVendorQualifier(QualStr);
}

mangleType(T->getBaseType());
Expand Down Expand Up @@ -4436,8 +4435,6 @@ void CXXNameMangler::mangleType(const UnaryTransformType *T) {
// If this is dependent, we need to record that. If not, we simply
// mangle it as the underlying type since they are equivalent.
if (T->isDependentType()) {
Out << "u";

StringRef BuiltinName;
switch (T->getUTTKind()) {
#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
Expand All @@ -4446,7 +4443,7 @@ void CXXNameMangler::mangleType(const UnaryTransformType *T) {
break;
#include "clang/Basic/TransformTypeTraits.def"
}
Out << BuiltinName.size() << BuiltinName;
mangleVendorType(BuiltinName);
}

Out << "I";
Expand Down Expand Up @@ -5311,9 +5308,8 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity,
// <expression> ::= u <source-name> <template-arg>* E # vendor extension
const TypeTraitExpr *TTE = cast<TypeTraitExpr>(E);
NotPrimaryExpr();
Out << 'u';
llvm::StringRef Spelling = getTraitSpelling(TTE->getTrait());
Out << Spelling.size() << Spelling;
mangleVendorType(Spelling);
for (TypeSourceInfo *TSI : TTE->getArgs()) {
mangleType(TSI->getType());
}
Expand Down
Loading

0 comments on commit 6fec2ec

Please sign in to comment.