Skip to content

Commit 947ddf5

Browse files
lei137arichardson
authored andcommitted
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.6-beta.1 [skip ci]
2 parents bcff8ce + f895fc9 commit 947ddf5

File tree

738 files changed

+17463
-8467
lines changed

Some content is hidden

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

738 files changed

+17463
-8467
lines changed

bolt/include/bolt/Profile/YAMLProfileReader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class YAMLProfileReader : public ProfileReaderBase {
105105
yaml::bolt::BinaryProfile YamlBP;
106106

107107
/// Map a function ID from a YAML profile to a BinaryFunction object.
108-
std::vector<BinaryFunction *> YamlProfileToFunction;
108+
DenseMap<uint32_t, BinaryFunction *> YamlProfileToFunction;
109109

110110
using FunctionSet = std::unordered_set<const BinaryFunction *>;
111111
/// To keep track of functions that have a matched profile before the profile
@@ -162,8 +162,6 @@ class YAMLProfileReader : public ProfileReaderBase {
162162
/// Update matched YAML -> BinaryFunction pair.
163163
void matchProfileToFunction(yaml::bolt::BinaryFunctionProfile &YamlBF,
164164
BinaryFunction &BF) {
165-
if (YamlBF.Id >= YamlProfileToFunction.size())
166-
YamlProfileToFunction.resize(YamlBF.Id + 1);
167165
YamlProfileToFunction[YamlBF.Id] = &BF;
168166
YamlBF.Used = true;
169167

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ bool YAMLProfileReader::parseFunctionProfile(
238238
BB.setExecutionCount(YamlBB.ExecCount);
239239

240240
for (const yaml::bolt::CallSiteInfo &YamlCSI : YamlBB.CallSites) {
241-
BinaryFunction *Callee = YamlCSI.DestId < YamlProfileToFunction.size()
242-
? YamlProfileToFunction[YamlCSI.DestId]
243-
: nullptr;
241+
BinaryFunction *Callee = YamlProfileToFunction.lookup(YamlCSI.DestId);
244242
bool IsFunction = Callee ? true : false;
245243
MCSymbol *CalleeSymbol = nullptr;
246244
if (IsFunction)
@@ -703,7 +701,7 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
703701
break;
704702
}
705703
}
706-
YamlProfileToFunction.resize(YamlBP.Functions.size() + 1);
704+
YamlProfileToFunction.reserve(YamlBP.Functions.size());
707705

708706
// Computes hash for binary functions.
709707
if (opts::MatchProfileWithFunctionHash) {
@@ -756,12 +754,7 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
756754
NormalizeByCalls = usesEvent("branches");
757755
uint64_t NumUnused = 0;
758756
for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
759-
if (YamlBF.Id >= YamlProfileToFunction.size()) {
760-
// Such profile was ignored.
761-
++NumUnused;
762-
continue;
763-
}
764-
if (BinaryFunction *BF = YamlProfileToFunction[YamlBF.Id])
757+
if (BinaryFunction *BF = YamlProfileToFunction.lookup(YamlBF.Id))
765758
parseFunctionProfile(*BF, YamlBF);
766759
else
767760
++NumUnused;

bolt/lib/Rewrite/PseudoProbeRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) {
127127

128128
StringRef Contents = PseudoProbeDescSection->getContents();
129129
if (!ProbeDecoder.buildGUID2FuncDescMap(
130-
reinterpret_cast<const uint8_t *>(Contents.data()),
131-
Contents.size())) {
130+
reinterpret_cast<const uint8_t *>(Contents.data()), Contents.size(),
131+
/*IsMMapped*/ true)) {
132132
errs() << "BOLT-WARNING: fail in building GUID2FuncDescMap\n";
133133
return;
134134
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ using namespace clang::ast_matchers;
1515
namespace clang::tidy::bugprone {
1616

1717
void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
18-
auto CtorInitializerList =
19-
cxxConstructorDecl(hasAnyConstructorInitializer(anything()));
20-
2118
Finder->addMatcher(
2219
cxxConstructExpr(
2320
hasType(cxxRecordDecl(
@@ -27,7 +24,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2724
stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
2825
hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
2926
hasAncestor(expr(cxxNewExpr(hasAnyPlacementArg(anything())))),
30-
allOf(hasAncestor(CtorInitializerList),
27+
allOf(hasAncestor(cxxConstructorDecl()),
3128
unless(hasAncestor(cxxCatchStmt()))))))
3229
.bind("temporary-exception-not-thrown"),
3330
this);

clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
#include "InitVariablesCheck.h"
1010

11+
#include "../utils/LexerUtils.h"
1112
#include "clang/AST/ASTContext.h"
13+
#include "clang/AST/Type.h"
1214
#include "clang/ASTMatchers/ASTMatchFinder.h"
13-
#include "clang/Lex/PPCallbacks.h"
1415
#include "clang/Lex/Preprocessor.h"
1516
#include <optional>
1617

@@ -107,8 +108,9 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
107108
<< MatchedDecl;
108109
if (*InitializationString != nullptr)
109110
Diagnostic << FixItHint::CreateInsertion(
110-
MatchedDecl->getLocation().getLocWithOffset(
111-
MatchedDecl->getName().size()),
111+
utils::lexer::findNextTerminator(MatchedDecl->getLocation(),
112+
*Result.SourceManager,
113+
Result.Context->getLangOpts()),
112114
*InitializationString);
113115
if (AddMathInclude) {
114116
Diagnostic << IncludeInserter.createIncludeInsertion(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ Changes in existing checks
177177
usages of ``sizeof()``, ``alignof()``, and ``offsetof()`` when adding or
178178
subtracting from a pointer directly or when used to scale a numeric value.
179179

180+
- Improved :doc:`bugprone-throw-keyword-missing
181+
<clang-tidy/checks/bugprone/throw-keyword-missing>` by fixing a false positive
182+
when using non-static member initializers and a constructor.
183+
180184
- Improved :doc:`bugprone-unchecked-optional-access
181185
<clang-tidy/checks/bugprone/unchecked-optional-access>` to support
182186
`bsl::optional` and `bdlb::NullableValue` from
@@ -190,6 +194,10 @@ Changes in existing checks
190194
fix false positive that floating point variable is only used in increment
191195
expression.
192196

197+
- Improved :doc:`cppcoreguidelines-init-variables
198+
<clang-tidy/checks/cppcoreguidelines/init-variables>` check by fixing the
199+
insertion location for function pointers.
200+
193201
- Improved :doc:`cppcoreguidelines-prefer-member-initializer
194202
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to
195203
avoid false positive when member initialization depends on a structured
@@ -208,9 +216,9 @@ Changes in existing checks
208216
false positive for C++23 deducing this.
209217

210218
- Improved :doc:`modernize-avoid-c-arrays
211-
<clang-tidy/checks/modernize/avoid-c-arrays>` check to suggest using ``std::span``
212-
as a replacement for parameters of incomplete C array type in C++20 and
213-
``std::array`` or ``std::vector`` before C++20.
219+
<clang-tidy/checks/modernize/avoid-c-arrays>` check to suggest using
220+
``std::span`` as a replacement for parameters of incomplete C array type in
221+
C++20 and ``std::array`` or ``std::vector`` before C++20.
214222

215223
- Improved :doc:`modernize-loop-convert
216224
<clang-tidy/checks/modernize/loop-convert>` check to fix false positive when

clang-tools-extra/test/clang-tidy/checkers/bugprone/throw-keyword-missing.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ CtorInitializerListTest::CtorInitializerListTest(float) try : exc(RegularExcepti
139139
RegularException();
140140
}
141141

142+
namespace GH115055 {
143+
class CtorInitializerListTest2 {
144+
public:
145+
CtorInitializerListTest2() {}
146+
private:
147+
RegularException exc{};
148+
};
149+
} // namespace GH115055
150+
142151
RegularException funcReturningExceptionTest(int i) {
143152
return RegularException();
144153
}

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,17 @@ void test_clang_diagnostic_error() {
134134
// CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-diagnostic-error]
135135
// CHECK-FIXES-NOT: {{^}} UnknownType b = 0;{{$}}
136136
}
137+
138+
namespace gh112089 {
139+
void foo(void*);
140+
using FPtr = void(*)(void*);
141+
void test() {
142+
void(*a1)(void*);
143+
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: variable 'a1' is not initialized [cppcoreguidelines-init-variables]
144+
// CHECK-FIXES: void(*a1)(void*) = nullptr;
145+
FPtr a2;
146+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: variable 'a2' is not initialized [cppcoreguidelines-init-variables]
147+
// CHECK-FIXES: FPtr a2 = nullptr;
148+
}
149+
} // namespace gh112089
150+

clang/docs/AMDGPUSupport.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Predefined Macros
5050
* - ``__AMDGCN_UNSAFE_FP_ATOMICS__``
5151
- Defined if unsafe floating-point atomics are allowed.
5252
* - ``__AMDGCN_WAVEFRONT_SIZE__``
53-
- Defines the wavefront size. Allowed values are 32 and 64.
53+
- Defines the wavefront size. Allowed values are 32 and 64 (deprecated).
5454
* - ``__AMDGCN_WAVEFRONT_SIZE``
55-
- Alias to ``__AMDGCN_WAVEFRONT_SIZE__``. To be deprecated.
55+
- Alias to ``__AMDGCN_WAVEFRONT_SIZE__`` (deprecated).
5656
* - ``__HAS_FMAF__``
5757
- Defined if FMAF instruction is available (deprecated).
5858
* - ``__HAS_LDEXPF__``

clang/docs/HIPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Predefined Macros
178178

179179
Note that some architecture specific AMDGPU macros will have default values when
180180
used from the HIP host compilation. Other :doc:`AMDGPU macros <AMDGPUSupport>`
181-
like ``__AMDGCN_WAVEFRONT_SIZE__`` will default to 64 for example.
181+
like ``__AMDGCN_WAVEFRONT_SIZE__`` (deprecated) will default to 64 for example.
182182

183183
Compilation Modes
184184
=================

0 commit comments

Comments
 (0)