Skip to content

Commit 27d9ee4

Browse files
committed
rebase
Created using spr 1.3.5-bogner
2 parents 61a8942 + 08f50e9 commit 27d9ee4

File tree

512 files changed

+21279
-5880
lines changed

Some content is hidden

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

512 files changed

+21279
-5880
lines changed

bolt/lib/Core/Exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
500500

501501
const FDE &CurFDE = *I->second;
502502
std::optional<uint64_t> LSDA = CurFDE.getLSDAAddress();
503-
Function.setLSDAAddress(LSDA ? *LSDA : 0);
503+
Function.setLSDAAddress(LSDA.value_or(0));
504504

505505
uint64_t Offset = Function.getFirstInstructionOffset();
506506
uint64_t CodeAlignment = CurFDE.getLinkedCIE()->getCodeAlignmentFactor();

clang-tools-extra/clang-include-fixer/IncludeFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Action : public clang::ASTFrontendAction {
5353

5454
Compiler->createSema(getTranslationUnitKind(), CompletionConsumer);
5555
SemaSource->setCompilerInstance(Compiler);
56-
Compiler->getSema().addExternalSource(SemaSource.get());
56+
Compiler->getSema().addExternalSource(SemaSource);
5757

5858
clang::ParseAST(Compiler->getSema(), Compiler->getFrontendOpts().ShowStats,
5959
Compiler->getFrontendOpts().SkipFunctionBodies);

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Checks: >
2222
-performance-unnecessary-value-param,
2323
readability-*,
2424
-readability-avoid-nested-conditional-operator,
25-
-readability-avoid-return-with-void-value,
2625
-readability-braces-around-statements,
2726
-readability-container-contains,
2827
-readability-convert-member-functions-to-static,

clang-tools-extra/clang-tidy/bugprone/InvalidEnumDefaultInitializationCheck.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ bool isCompleteAndHasNoZeroValue(const EnumDecl *D) {
2222
const EnumDecl *Definition = D->getDefinition();
2323
return Definition && Definition->isComplete() &&
2424
!Definition->enumerators().empty() &&
25-
std::none_of(Definition->enumerator_begin(),
26-
Definition->enumerator_end(),
27-
[](const EnumConstantDecl *Value) {
28-
return Value->getInitVal().isZero();
29-
});
25+
llvm::none_of(Definition->enumerators(),
26+
[](const EnumConstantDecl *Value) {
27+
return Value->getInitVal().isZero();
28+
});
3029
}
3130

3231
AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue) {

clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,11 @@ void NarrowingConversionsCheck::diagNarrowTypeOrConstant(
381381
const Expr &Rhs) {
382382
APValue Constant = getConstantExprValue(Context, Rhs);
383383
if (Constant.isInt())
384-
return diagNarrowIntegerConstant(SourceLoc, Lhs, Rhs, Constant.getInt());
385-
if (Constant.isFloat())
386-
return diagNarrowConstant(SourceLoc, Lhs, Rhs);
387-
return diagNarrowType(SourceLoc, Lhs, Rhs);
384+
diagNarrowIntegerConstant(SourceLoc, Lhs, Rhs, Constant.getInt());
385+
else if (Constant.isFloat())
386+
diagNarrowConstant(SourceLoc, Lhs, Rhs);
387+
else
388+
diagNarrowType(SourceLoc, Lhs, Rhs);
388389
}
389390

390391
void NarrowingConversionsCheck::handleIntegralCast(const ASTContext &Context,
@@ -460,10 +461,10 @@ void NarrowingConversionsCheck::handleFloatingToIntegral(
460461
llvm::APFloat FloatConstant(0.0);
461462
if (getFloatingConstantExprValue(Context, Rhs, FloatConstant)) {
462463
if (!isFloatExactlyRepresentable(Context, FloatConstant, Lhs.getType()))
463-
return diagNarrowConstant(SourceLoc, Lhs, Rhs);
464+
diagNarrowConstant(SourceLoc, Lhs, Rhs);
464465

465-
if (PedanticMode)
466-
return diagConstantCast(SourceLoc, Lhs, Rhs);
466+
else if (PedanticMode)
467+
diagConstantCast(SourceLoc, Lhs, Rhs);
467468

468469
return;
469470
}
@@ -478,7 +479,7 @@ void NarrowingConversionsCheck::handleFloatingToIntegral(
478479
void NarrowingConversionsCheck::handleFloatingToBoolean(
479480
const ASTContext &Context, SourceLocation SourceLoc, const Expr &Lhs,
480481
const Expr &Rhs) {
481-
return diagNarrowTypeOrConstant(Context, SourceLoc, Lhs, Rhs);
482+
diagNarrowTypeOrConstant(Context, SourceLoc, Lhs, Rhs);
482483
}
483484

484485
void NarrowingConversionsCheck::handleBooleanToSignedIntegral(
@@ -532,19 +533,20 @@ void NarrowingConversionsCheck::handleBinaryOperator(const ASTContext &Context,
532533
if (LhsType == RhsType)
533534
return;
534535
if (RhsType->getKind() == BuiltinType::Bool && LhsType->isSignedInteger())
535-
return handleBooleanToSignedIntegral(Context, SourceLoc, Lhs, Rhs);
536-
if (RhsType->isInteger() && LhsType->getKind() == BuiltinType::Bool)
537-
return handleIntegralToBoolean(Context, SourceLoc, Lhs, Rhs);
538-
if (RhsType->isInteger() && LhsType->isFloatingPoint())
539-
return handleIntegralToFloating(Context, SourceLoc, Lhs, Rhs);
540-
if (RhsType->isInteger() && LhsType->isInteger())
541-
return handleIntegralCast(Context, SourceLoc, Lhs, Rhs);
542-
if (RhsType->isFloatingPoint() && LhsType->getKind() == BuiltinType::Bool)
543-
return handleFloatingToBoolean(Context, SourceLoc, Lhs, Rhs);
544-
if (RhsType->isFloatingPoint() && LhsType->isInteger())
545-
return handleFloatingToIntegral(Context, SourceLoc, Lhs, Rhs);
546-
if (RhsType->isFloatingPoint() && LhsType->isFloatingPoint())
547-
return handleFloatingCast(Context, SourceLoc, Lhs, Rhs);
536+
handleBooleanToSignedIntegral(Context, SourceLoc, Lhs, Rhs);
537+
else if (RhsType->isInteger() && LhsType->getKind() == BuiltinType::Bool)
538+
handleIntegralToBoolean(Context, SourceLoc, Lhs, Rhs);
539+
else if (RhsType->isInteger() && LhsType->isFloatingPoint())
540+
handleIntegralToFloating(Context, SourceLoc, Lhs, Rhs);
541+
else if (RhsType->isInteger() && LhsType->isInteger())
542+
handleIntegralCast(Context, SourceLoc, Lhs, Rhs);
543+
else if (RhsType->isFloatingPoint() &&
544+
LhsType->getKind() == BuiltinType::Bool)
545+
handleFloatingToBoolean(Context, SourceLoc, Lhs, Rhs);
546+
else if (RhsType->isFloatingPoint() && LhsType->isInteger())
547+
handleFloatingToIntegral(Context, SourceLoc, Lhs, Rhs);
548+
else if (RhsType->isFloatingPoint() && LhsType->isFloatingPoint())
549+
handleFloatingCast(Context, SourceLoc, Lhs, Rhs);
548550
}
549551

550552
bool NarrowingConversionsCheck::handleConditionalOperator(
@@ -577,21 +579,28 @@ void NarrowingConversionsCheck::handleImplicitCast(
577579
SourceLocation SourceLoc = Lhs.getExprLoc();
578580
switch (Cast.getCastKind()) {
579581
case CK_BooleanToSignedIntegral:
580-
return handleBooleanToSignedIntegral(Context, SourceLoc, Lhs, Rhs);
582+
handleBooleanToSignedIntegral(Context, SourceLoc, Lhs, Rhs);
583+
return;
581584
case CK_IntegralToBoolean:
582-
return handleIntegralToBoolean(Context, SourceLoc, Lhs, Rhs);
585+
handleIntegralToBoolean(Context, SourceLoc, Lhs, Rhs);
586+
return;
583587
case CK_IntegralToFloating:
584-
return handleIntegralToFloating(Context, SourceLoc, Lhs, Rhs);
588+
handleIntegralToFloating(Context, SourceLoc, Lhs, Rhs);
589+
return;
585590
case CK_IntegralCast:
586-
return handleIntegralCast(Context, SourceLoc, Lhs, Rhs);
591+
handleIntegralCast(Context, SourceLoc, Lhs, Rhs);
592+
return;
587593
case CK_FloatingToBoolean:
588-
return handleFloatingToBoolean(Context, SourceLoc, Lhs, Rhs);
594+
handleFloatingToBoolean(Context, SourceLoc, Lhs, Rhs);
595+
return;
589596
case CK_FloatingToIntegral:
590-
return handleFloatingToIntegral(Context, SourceLoc, Lhs, Rhs);
597+
handleFloatingToIntegral(Context, SourceLoc, Lhs, Rhs);
598+
return;
591599
case CK_FloatingCast:
592-
return handleFloatingCast(Context, SourceLoc, Lhs, Rhs);
600+
handleFloatingCast(Context, SourceLoc, Lhs, Rhs);
601+
return;
593602
default:
594-
break;
603+
return;
595604
}
596605
}
597606

@@ -610,9 +619,10 @@ void NarrowingConversionsCheck::handleBinaryOperator(const ASTContext &Context,
610619

611620
void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) {
612621
if (const auto *Op = Result.Nodes.getNodeAs<BinaryOperator>("binary_op"))
613-
return handleBinaryOperator(*Result.Context, *Op);
614-
if (const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast"))
615-
return handleImplicitCast(*Result.Context, *Cast);
616-
llvm_unreachable("must be binary operator or cast expression");
622+
handleBinaryOperator(*Result.Context, *Op);
623+
else if (const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast"))
624+
handleImplicitCast(*Result.Context, *Cast);
625+
else
626+
llvm_unreachable("must be binary operator or cast expression");
617627
}
618628
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/bugprone/NonZeroEnumToBoolConversionCheck.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ namespace {
2222
AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue) {
2323
const EnumDecl *Definition = Node.getDefinition();
2424
return Definition && Node.isComplete() &&
25-
std::none_of(Definition->enumerator_begin(),
26-
Definition->enumerator_end(),
27-
[](const EnumConstantDecl *Value) {
28-
return Value->getInitVal().isZero();
29-
});
25+
llvm::none_of(Definition->enumerators(),
26+
[](const EnumConstantDecl *Value) {
27+
return Value->getInitVal().isZero();
28+
});
3029
}
3130

3231
} // namespace

clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,15 @@ void ImplicitBoolConversionCheck::check(
361361
if (const auto *CastToBool =
362362
Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastToBool")) {
363363
const auto *Parent = Result.Nodes.getNodeAs<Stmt>("parentStmt");
364-
return handleCastToBool(CastToBool, Parent, *Result.Context);
364+
handleCastToBool(CastToBool, Parent, *Result.Context);
365+
return;
365366
}
366367

367368
if (const auto *CastFromBool =
368369
Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastFromBool")) {
369370
const auto *NextImplicitCast =
370371
Result.Nodes.getNodeAs<ImplicitCastExpr>("furtherImplicitCast");
371-
return handleCastFromBool(CastFromBool, NextImplicitCast, *Result.Context);
372+
handleCastFromBool(CastFromBool, NextImplicitCast, *Result.Context);
372373
}
373374
}
374375

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ RenamerClangTidyCheck::addUsage(
432432
if (FixLocation.isInvalid())
433433
return {NamingCheckFailures.end(), false};
434434

435+
// Skip if in system system header
436+
if (SourceMgr.isInSystemHeader(FixLocation))
437+
return {NamingCheckFailures.end(), false};
438+
435439
auto EmplaceResult = NamingCheckFailures.try_emplace(FailureId);
436440
NamingCheckFailure &Failure = EmplaceResult.first->second;
437441

@@ -455,6 +459,9 @@ RenamerClangTidyCheck::addUsage(
455459
void RenamerClangTidyCheck::addUsage(const NamedDecl *Decl,
456460
SourceRange UsageRange,
457461
const SourceManager &SourceMgr) {
462+
if (SourceMgr.isInSystemHeader(Decl->getLocation()))
463+
return;
464+
458465
if (hasNoName(Decl))
459466
return;
460467

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ Changes in existing checks
130130
<clang-tidy/checks/bugprone/infinite-loop>` check by adding detection for
131131
variables introduced by structured bindings.
132132

133+
- Improved :doc:`bugprone-reserved-identifier
134+
<clang-tidy/checks/bugprone/reserved-identifier>` check by ignoring
135+
declarations in system headers.
136+
133137
- Improved :doc:`bugprone-signed-char-misuse
134138
<clang-tidy/checks/bugprone/signed-char-misuse>` check by fixing
135139
false positives on C23 enums with the fixed underlying type of signed char.
@@ -160,6 +164,10 @@ Changes in existing checks
160164
<clang-tidy/checks/portability/template-virtual-member-function>` check to
161165
avoid false positives on pure virtual member functions.
162166

167+
- Improved :doc:`readability-identifier-naming
168+
<clang-tidy/checks/readability/identifier-naming>` check by ignoring
169+
declarations in system headers.
170+
163171
- Improved :doc:`readability-qualified-auto
164172
<clang-tidy/checks/readability/qualified-auto>` check by adding the option
165173
`IgnoreAliasing`, that allows not looking at underlying types of type aliases.

clang/docs/LanguageExtensions.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ even if there is no valid ``std::tuple_element`` specialization or suitable
20182018
Blocks
20192019
======
20202020

2021-
The syntax and high level language feature description is in
2021+
The syntax and high-level language feature description is in
20222022
:doc:`BlockLanguageSpec<BlockLanguageSpec>`. Implementation and ABI details for
20232023
the clang implementation are in :doc:`Block-ABI-Apple<Block-ABI-Apple>`.
20242024

@@ -2088,7 +2088,7 @@ producing an object with the following member functions
20882088
constexpr size_t size() const;
20892089

20902090
such as ``std::string``, ``std::string_view``, ``std::vector<char>``.
2091-
This mechanism follow the same rules as ``static_assert`` messages in
2091+
This mechanism follows the same rules as ``static_assert`` messages in
20922092
C++26, see ``[dcl.pre]/p12``.
20932093

20942094
Query for this feature with ``__has_extension(gnu_asm_constexpr_strings)``.
@@ -2335,7 +2335,7 @@ Objective-C Autosynthesis of Properties
23352335
23362336
Clang provides support for autosynthesis of declared properties. Using this
23372337
feature, clang provides default synthesis of those properties not declared
2338-
@dynamic and not having user provided backing getter and setter methods.
2338+
@dynamic and not having user-provided backing getter and setter methods.
23392339
``__has_feature(objc_default_synthesize_properties)`` checks for availability
23402340
of this feature in version of clang being used.
23412341
@@ -2349,7 +2349,7 @@ In Objective-C, functions and methods are generally assumed to follow the
23492349
<https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html>`_
23502350
conventions for ownership of object arguments and
23512351
return values. However, there are exceptions, and so Clang provides attributes
2352-
to allow these exceptions to be documented. This are used by ARC and the
2352+
to allow these exceptions to be documented. These are used by ARC and the
23532353
`static analyzer <https://clang-analyzer.llvm.org>`_ Some exceptions may be
23542354
better described using the ``objc_method_family`` attribute instead.
23552355
@@ -2575,7 +2575,7 @@ Such functionality is not conformant and does not guarantee to compile
25752575
correctly in any circumstances. It can be used if:
25762576
25772577
- the kernel source does not contain call expressions to (member-) function
2578-
pointers, or virtual functions. For example this extension can be used in
2578+
pointers, or virtual functions. For example, this extension can be used in
25792579
metaprogramming algorithms to be able to specify/detect types generically.
25802580
25812581
- the generated kernel binary does not contain indirect calls because they
@@ -2613,7 +2613,7 @@ functions with variadic prototypes do not get generated in binary e.g. the
26132613
variadic prototype is used to specify a function type with any number of
26142614
arguments in metaprogramming algorithms in C++ for OpenCL.
26152615
2616-
This extensions can also be used when the kernel code is intended for targets
2616+
This extension can also be used when the kernel code is intended for targets
26172617
supporting the variadic arguments e.g. majority of CPU targets.
26182618
26192619
**Example of Use**:
@@ -2702,7 +2702,7 @@ address space qualifiers, therefore, other type qualifiers such as
27022702
Legacy 1.x atomics with generic address space
27032703
---------------------------------------------
27042704
2705-
Clang allows use of atomic functions from the OpenCL 1.x standards
2705+
Clang allows the use of atomic functions from the OpenCL 1.x standards
27062706
with the generic address space pointer in C++ for OpenCL mode.
27072707
27082708
This is a non-portable feature and might not be supported by all
@@ -2833,7 +2833,7 @@ to a possibly overlapping destination region. It takes five arguments.
28332833
The first argument is the destination WebAssembly table, and the second
28342834
argument is the source WebAssembly table. The third argument is the
28352835
destination index from where the copy starts, the fourth argument is the
2836-
source index from there the copy starts, and the fifth and last argument
2836+
source index from where the copy starts, and the fifth and last argument
28372837
is the number of elements to copy. It returns nothing.
28382838
28392839
.. code-block:: c++
@@ -3133,7 +3133,7 @@ Query for this feature with ``__has_builtin(__builtin_get_vtable_pointer)``.
31333133
------------------------------------
31343134
31353135
``__builtin_call_with_static_chain`` is used to perform a static call while
3136-
setting updating the static chain register.
3136+
updating the static chain register.
31373137
31383138
**Syntax**:
31393139
@@ -3245,7 +3245,7 @@ Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``.
32453245
The ``__builtin_cpu_supports`` function detects if the run-time CPU supports
32463246
features specified in string argument. It returns a positive integer if all
32473247
features are supported and 0 otherwise. Feature names are target specific. On
3248-
AArch64 features are combined using ``+`` like this
3248+
AArch64, features are combined using ``+`` like this
32493249
``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``.
32503250
If a feature name is not supported, Clang will issue a warning and replace
32513251
builtin by the constant 0.
@@ -3465,7 +3465,7 @@ Query for this feature with ``__has_builtin(__builtin_convertvector)``.
34653465
**Description**:
34663466
34673467
The '``__builtin_bitreverse``' family of builtins is used to reverse
3468-
the bitpattern of an integer value; for example ``0b10110110`` becomes
3468+
the bitpattern of an integer value; for example, ``0b10110110`` becomes
34693469
``0b01101101``. These builtins can be used within constant expressions.
34703470
34713471
``__builtin_rotateleft``
@@ -3970,7 +3970,7 @@ the debugging experience.
39703970
39713971
``__builtin_allow_runtime_check`` returns true if the check at the current
39723972
program location should be executed. It is expected to be used to implement
3973-
``assert`` like checks which can be safely removed by optimizer.
3973+
``assert`` like checks which can be safely removed by the optimizer.
39743974
39753975
**Syntax**:
39763976

0 commit comments

Comments
 (0)