Skip to content

Commit 7e79490

Browse files
committed
[AutoBump] Merge with 770393b (Jun 17)
2 parents ab22c35 + 770393b commit 7e79490

File tree

395 files changed

+18861
-6318
lines changed

Some content is hidden

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

395 files changed

+18861
-6318
lines changed

clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ void InefficientVectorOperationCheck::addMatcher(
105105
onImplicitObjectArgument(declRefExpr(to(TargetVarDecl))))
106106
.bind(AppendCallName);
107107
const auto AppendCall = expr(ignoringImplicit(AppendCallExpr));
108-
const auto LoopVarInit =
109-
declStmt(hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
110-
.bind(LoopInitVarName)));
108+
const auto LoopVarInit = declStmt(hasSingleDecl(
109+
varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral(equals(0)))))
110+
.bind(LoopInitVarName)));
111111
const auto RefersToLoopVar = ignoringParenImpCasts(
112112
declRefExpr(to(varDecl(equalsBoundNode(LoopInitVarName)))));
113113

clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) {
4444
unless(isInTemplateInstantiation()))
4545
.bind("call-move");
4646

47-
Finder->addMatcher(MoveCallMatcher, this);
47+
Finder->addMatcher(
48+
expr(anyOf(
49+
castExpr(hasSourceExpression(MoveCallMatcher)),
50+
cxxConstructExpr(hasDeclaration(cxxConstructorDecl(anyOf(
51+
isCopyConstructor(), isMoveConstructor()))),
52+
hasArgument(0, MoveCallMatcher)))),
53+
this);
4854

4955
auto ConstTypeParmMatcher =
5056
qualType(references(isConstQualified())).bind("invocation-parm-type");

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,15 @@ Changes in existing checks
387387
- Improved :doc:`modernize-use-using <clang-tidy/checks/modernize/use-using>`
388388
check by adding support for detection of typedefs declared on function level.
389389

390+
- Improved :doc:`performance-inefficient-vector-operation
391+
<clang-tidy/checks/performance/inefficient-vector-operation>` fixing false
392+
negatives caused by different variable definition type and variable initial
393+
value type in loop initialization expression.
394+
395+
- Improved :doc:`performance-move-const-arg
396+
<clang-tidy/checks/performance/move-const-arg>` check by ignoring
397+
``std::move()`` calls when their target is used as an rvalue.
398+
390399
- Improved :doc:`performance-unnecessary-copy-initialization
391400
<clang-tidy/checks/performance/unnecessary-copy-initialization>` check by
392401
detecting more cases of constant access. In particular, pointers can be

clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-vector-operation.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,38 @@ void foo(const StructWithFieldContainer &Src) {
387387
B.push_back(Number);
388388
}
389389
}
390+
391+
namespace gh95596 {
392+
393+
void f(std::vector<int>& t) {
394+
{
395+
std::vector<int> gh95596_0;
396+
// CHECK-FIXES: gh95596_0.reserve(10);
397+
for (unsigned i = 0; i < 10; ++i)
398+
gh95596_0.push_back(i);
399+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop
400+
}
401+
{
402+
std::vector<int> gh95596_1;
403+
// CHECK-FIXES: gh95596_1.reserve(10);
404+
for (int i = 0U; i < 10; ++i)
405+
gh95596_1.push_back(i);
406+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop
407+
}
408+
{
409+
std::vector<int> gh95596_2;
410+
// CHECK-FIXES: gh95596_2.reserve(10);
411+
for (unsigned i = 0U; i < 10; ++i)
412+
gh95596_2.push_back(i);
413+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop
414+
}
415+
{
416+
std::vector<int> gh95596_3;
417+
// CHECK-FIXES: gh95596_3.reserve(10U);
418+
for (int i = 0; i < 10U; ++i)
419+
gh95596_3.push_back(i);
420+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop
421+
}
422+
}
423+
424+
} // namespace gh95596

clang-tools-extra/test/clang-tidy/checkers/performance/move-const-arg.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,18 @@ void f8() {
114114
int f9() { return M2(1); }
115115

116116
template <typename T>
117-
T f10(const int x10) {
117+
T f_unknown_target(const int x10) {
118118
return std::move(x10);
119-
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable 'x10' of the trivially-copyable type 'const int' has no effect; remove std::move() [performance-move-const-arg]
120-
// CHECK-FIXES: return x10;
121119
}
120+
122121
void f11() {
123-
f10<int>(1);
124-
f10<double>(1);
122+
f_unknown_target<int>(1);
123+
f_unknown_target<double>(1);
124+
}
125+
126+
A&& f_return_right_ref() {
127+
static A a{};
128+
return std::move(a);
125129
}
126130

127131
class NoMoveSemantics {

clang/docs/CommandGuide/clang.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ number of cross compilers, or may only support a native target.
362362

363363
Specify the architecture to build for (all platforms).
364364

365-
.. option:: -mmacosx-version-min=<version>
365+
.. option:: -mmacos-version-min=<version>
366366

367367
When building for macOS, specify the minimum version supported by your
368368
application.
@@ -723,7 +723,7 @@ ENVIRONMENT
723723

724724
.. envvar:: MACOSX_DEPLOYMENT_TARGET
725725

726-
If :option:`-mmacosx-version-min` is unspecified, the default deployment
726+
If :option:`-mmacos-version-min` is unspecified, the default deployment
727727
target is read from this environment variable. This option only affects
728728
Darwin targets.
729729

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ Objective-C @available
20632063
----------------------
20642064
20652065
It is possible to use the newest SDK but still build a program that can run on
2066-
older versions of macOS and iOS by passing ``-mmacosx-version-min=`` /
2066+
older versions of macOS and iOS by passing ``-mmacos-version-min=`` /
20672067
``-miphoneos-version-min=``.
20682068
20692069
Before LLVM 5.0, when calling a function that exists only in the OS that's
@@ -2084,7 +2084,7 @@ When a method that's introduced in the OS newer than the target OS is called, a
20842084
20852085
void my_fun(NSSomeClass* var) {
20862086
// If fancyNewMethod was added in e.g. macOS 10.12, but the code is
2087-
// built with -mmacosx-version-min=10.11, then this unconditional call
2087+
// built with -mmacos-version-min=10.11, then this unconditional call
20882088
// will emit a -Wunguarded-availability warning:
20892089
[var fancyNewMethod];
20902090
}

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ Bug Fixes to C++ Support
858858
- Fixed several bugs in capturing variables within unevaluated contexts. (#GH63845), (#GH67260), (#GH69307),
859859
(#GH88081), (#GH89496), (#GH90669) and (#GH91633).
860860
- Fixed handling of brace ellison when building deduction guides. (#GH64625), (#GH83368).
861+
- Clang now instantiates local constexpr functions eagerly for constant evaluators. (#GH35052), (#GH94849)
861862

862863
Bug Fixes to AST Handling
863864
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/UsersManual.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,6 +3347,9 @@ below. If multiple flags are present, the last one is used.
33473347
By default, Clang does not emit type information for types that are defined
33483348
but not used in a program. To retain the debug info for these unused types,
33493349
the negation **-fno-eliminate-unused-debug-types** can be used.
3350+
This can be particulary useful on Windows, when using NATVIS files that
3351+
can reference const symbols that would otherwise be stripped, even in full
3352+
debug or standalone debug modes.
33503353

33513354
Controlling Macro Debug Info Generation
33523355
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/DeclBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ class alignas(8) Decl {
670670
/// Whether this declaration comes from another module unit.
671671
bool isInAnotherModuleUnit() const;
672672

673+
/// Whether this declaration comes from the same module unit being compiled.
674+
bool isInCurrentModuleUnit() const;
675+
673676
/// Whether the definition of the declaration should be emitted in external
674677
/// sources.
675678
bool shouldEmitInExternalSource() const;

0 commit comments

Comments
 (0)