Skip to content

Commit a7c4ef0

Browse files
committed
Rebase
Created using spr 1.3.7
2 parents 9f53d49 + 5b7a5f7 commit a7c4ef0

File tree

581 files changed

+12158
-10115
lines changed

Some content is hidden

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

581 files changed

+12158
-10115
lines changed

.ci/generate_test_report_lib.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def _parse_ninja_log(ninja_log: list[str]) -> list[tuple[str, str]]:
4141
# touch test/4.stamp
4242
#
4343
# index will point to the line that starts with Failed:. The progress
44-
# indicator is the line before this ([4/5] test/4.stamp) and contains a pretty
45-
# printed version of the target being built (test/4.stamp). We use this line
46-
# and remove the progress information to get a succinct name for the target.
47-
failing_action = ninja_log[index - 1].split("] ")[1]
44+
# indicator is sometimes the line before this ([4/5] test/4.stamp) and
45+
# will contain a pretty printed version of the target being built
46+
# (test/4.stamp) when accurate. We instead parse the failed line rather
47+
# than the progress indicator as the progress indicator may not be
48+
# aligned with the failure.
49+
failing_action = ninja_log[index].split("FAILED: ")[1]
4850
failure_log = []
4951
while (
5052
index < len(ninja_log)

.ci/generate_test_report_lib_test.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_find_failure_ninja_logs(self):
3939
self.assertEqual(
4040
failures[0],
4141
(
42-
"test/4.stamp",
42+
"touch test/4.stamp",
4343
dedent(
4444
"""\
4545
FAILED: touch test/4.stamp
@@ -77,7 +77,7 @@ def test_ninja_log_end(self):
7777
self.assertEqual(
7878
failures[0],
7979
(
80-
"test/3.stamp",
80+
"touch test/3.stamp",
8181
dedent(
8282
"""\
8383
FAILED: touch test/3.stamp
@@ -106,7 +106,7 @@ def test_ninja_log_multiple_failures(self):
106106
self.assertEqual(
107107
failures[0],
108108
(
109-
"test/2.stamp",
109+
"touch test/2.stamp",
110110
dedent(
111111
"""\
112112
FAILED: touch test/2.stamp
@@ -117,7 +117,7 @@ def test_ninja_log_multiple_failures(self):
117117
self.assertEqual(
118118
failures[1],
119119
(
120-
"test/4.stamp",
120+
"touch test/4.stamp",
121121
dedent(
122122
"""\
123123
FAILED: touch test/4.stamp
@@ -150,7 +150,7 @@ def test_ninja_log_runtimes_failure(self):
150150
self.assertEqual(
151151
failures[0],
152152
(
153-
"test/2.stamp",
153+
"touch test/2.stamp",
154154
dedent(
155155
"""\
156156
FAILED: touch test/2.stamp
@@ -159,6 +159,34 @@ def test_ninja_log_runtimes_failure(self):
159159
),
160160
)
161161

162+
# Test that we correctly handle cases where the FAILED: line does not
163+
# match up with the progress indicator.
164+
def test_ninja_log_mismatched_failed(self):
165+
failures = generate_test_report_lib.find_failure_in_ninja_logs(
166+
[
167+
[
168+
"[1/5] test/1.stamp",
169+
"[2/5] test/2.stamp",
170+
"ModuleNotFoundError: No module named 'mount_langley'",
171+
"FAILED: tools/check-langley",
172+
"Wow! This system is really broken!",
173+
"[5/5] test/5.stamp",
174+
]
175+
]
176+
)
177+
self.assertEqual(len(failures), 1)
178+
self.assertEqual(
179+
failures[0],
180+
(
181+
"tools/check-langley",
182+
dedent(
183+
"""\
184+
FAILED: tools/check-langley
185+
Wow! This system is really broken!"""
186+
),
187+
),
188+
)
189+
162190
def test_title_only(self):
163191
self.assertEqual(
164192
generate_test_report_lib.generate_report("Foo", 0, [], []),
@@ -407,7 +435,6 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
407435
]
408436
],
409437
)
410-
print(test)
411438
self.assertEqual(
412439
generate_test_report_lib.generate_report(
413440
"Foo",
@@ -449,15 +476,15 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
449476
All tests passed but another part of the build **failed**. Click on a failure below to see the details.
450477
451478
<details>
452-
<summary>test/2.stamp</summary>
479+
<summary>touch test/2.stamp</summary>
453480
454481
```
455482
FAILED: touch test/2.stamp
456483
Wow! Be Kind!
457484
```
458485
</details>
459486
<details>
460-
<summary>test/4.stamp</summary>
487+
<summary>touch test/4.stamp</summary>
461488
462489
```
463490
FAILED: touch test/4.stamp

.ci/premerge_advisor_explain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def main(commit_sha: str, build_log_files: list[str]):
4040
explanation_request["failures"].append(
4141
{"name": name, "message": failure_message}
4242
)
43-
advisor_response = requests.get(PREMERGE_ADVISOR_URL, json=explanation_request)
43+
advisor_response = requests.get(
44+
PREMERGE_ADVISOR_URL, json=explanation_request, timeout=5
45+
)
4446
if advisor_response.status_code == 200:
4547
print(advisor_response.json())
4648
else:

.ci/premerge_advisor_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main(commit_sha, workflow_run_number, build_log_files):
4545
for name, failure_message in ninja_failures:
4646
failure_info["failures"].append({"name": name, "message": failure_message})
4747
for premerge_advisor_url in PREMERGE_ADVISOR_URLS:
48-
requests.post(premerge_advisor_url, json=failure_info)
48+
requests.post(premerge_advisor_url, json=failure_info, timeout=5)
4949

5050

5151
if __name__ == "__main__":

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,8 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
13211321
}
13221322

13231323
using SSI = StringSwitch<int>;
1324-
AddrNum = SSI(Str).Cases("T", "R", 3).Case("S", 1).Case("E", 0).Default(2);
1324+
AddrNum =
1325+
SSI(Str).Cases({"T", "R"}, 3).Case("S", 1).Case("E", 0).Default(2);
13251326
CounterNum = SSI(Str).Case("B", 2).Case("E", 0).Default(1);
13261327
}
13271328

@@ -2215,7 +2216,7 @@ DataAggregator::writeAggregatedFile(StringRef OutputFilename) const {
22152216
OutFile << "boltedcollection\n";
22162217
if (opts::BasicAggregation) {
22172218
OutFile << "no_lbr";
2218-
for (const StringMapEntry<std::nullopt_t> &Entry : EventNames)
2219+
for (const StringMapEntry<EmptyStringSetTag> &Entry : EventNames)
22192220
OutFile << " " << Entry.getKey();
22202221
OutFile << "\n";
22212222

@@ -2291,7 +2292,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
22912292

22922293
ListSeparator LS(",");
22932294
raw_string_ostream EventNamesOS(BP.Header.EventNames);
2294-
for (const StringMapEntry<std::nullopt_t> &EventEntry : EventNames)
2295+
for (const StringMapEntry<EmptyStringSetTag> &EventEntry : EventNames)
22952296
EventNamesOS << LS << EventEntry.first().str();
22962297

22972298
BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_BASIC

bolt/lib/Profile/YAMLProfileWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ std::error_code YAMLProfileWriter::writeProfile(const RewriteInstance &RI) {
382382
StringSet<> EventNames = RI.getProfileReader()->getEventNames();
383383
if (!EventNames.empty()) {
384384
std::string Sep;
385-
for (const StringMapEntry<std::nullopt_t> &EventEntry : EventNames) {
385+
for (const StringMapEntry<EmptyStringSetTag> &EventEntry : EventNames) {
386386
BP.Header.EventNames += Sep + EventEntry.first().str();
387387
Sep = ",";
388388
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "CopyConstructorInitCheck.h"
2525
#include "CrtpConstructorAccessibilityCheck.h"
2626
#include "DanglingHandleCheck.h"
27+
#include "DefaultOperatorNewOnOveralignedTypeCheck.h"
2728
#include "DerivedMethodShadowingBaseMethodCheck.h"
2829
#include "DynamicStaticInitializersCheck.h"
2930
#include "EasilySwappableParametersCheck.h"
@@ -61,6 +62,7 @@
6162
#include "ParentVirtualCallCheck.h"
6263
#include "PointerArithmeticOnPolymorphicObjectCheck.h"
6364
#include "PosixReturnCheck.h"
65+
#include "RawMemoryCallOnNonTrivialTypeCheck.h"
6466
#include "RedundantBranchConditionCheck.h"
6567
#include "ReservedIdentifierCheck.h"
6668
#include "ReturnConstRefFromParameterCheck.h"
@@ -139,6 +141,8 @@ class BugproneModule : public ClangTidyModule {
139141
"bugprone-copy-constructor-init");
140142
CheckFactories.registerCheck<DanglingHandleCheck>(
141143
"bugprone-dangling-handle");
144+
CheckFactories.registerCheck<DefaultOperatorNewOnOveralignedTypeCheck>(
145+
"bugprone-default-operator-new-on-overaligned-type");
142146
CheckFactories.registerCheck<DerivedMethodShadowingBaseMethodCheck>(
143147
"bugprone-derived-method-shadowing-base-method");
144148
CheckFactories.registerCheck<DynamicStaticInitializersCheck>(
@@ -216,6 +220,8 @@ class BugproneModule : public ClangTidyModule {
216220
CheckFactories.registerCheck<ParentVirtualCallCheck>(
217221
"bugprone-parent-virtual-call");
218222
CheckFactories.registerCheck<PosixReturnCheck>("bugprone-posix-return");
223+
CheckFactories.registerCheck<RawMemoryCallOnNonTrivialTypeCheck>(
224+
"bugprone-raw-memory-call-on-non-trivial-type");
219225
CheckFactories.registerCheck<ReservedIdentifierCheck>(
220226
"bugprone-reserved-identifier");
221227
CheckFactories.registerCheck<SharedPtrArrayMismatchCheck>(

clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ add_clang_library(clangTidyBugproneModule STATIC
2020
CopyConstructorInitCheck.cpp
2121
CrtpConstructorAccessibilityCheck.cpp
2222
DanglingHandleCheck.cpp
23+
DefaultOperatorNewOnOveralignedTypeCheck.cpp
2324
DerivedMethodShadowingBaseMethodCheck.cpp
2425
DynamicStaticInitializersCheck.cpp
2526
EasilySwappableParametersCheck.cpp
@@ -62,6 +63,7 @@ add_clang_library(clangTidyBugproneModule STATIC
6263
ParentVirtualCallCheck.cpp
6364
PointerArithmeticOnPolymorphicObjectCheck.cpp
6465
PosixReturnCheck.cpp
66+
RawMemoryCallOnNonTrivialTypeCheck.cpp
6567
RedundantBranchConditionCheck.cpp
6668
ReservedIdentifierCheck.cpp
6769
ReturnConstRefFromParameterCheck.cpp

clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp renamed to clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "DefaultOperatorNewAlignmentCheck.h"
9+
#include "DefaultOperatorNewOnOveralignedTypeCheck.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
1212
#include "clang/Basic/TargetInfo.h"
1313

1414
using namespace clang::ast_matchers;
1515

16-
namespace clang::tidy::cert {
16+
namespace clang::tidy::bugprone {
1717

18-
void DefaultOperatorNewAlignmentCheck::registerMatchers(MatchFinder *Finder) {
18+
void DefaultOperatorNewOnOveralignedTypeCheck::registerMatchers(
19+
MatchFinder *Finder) {
1920
Finder->addMatcher(
2021
cxxNewExpr(unless(hasAnyPlacementArg(anything()))).bind("new"), this);
2122
}
2223

23-
void DefaultOperatorNewAlignmentCheck::check(
24+
void DefaultOperatorNewOnOveralignedTypeCheck::check(
2425
const MatchFinder::MatchResult &Result) {
2526
// Get the found 'new' expression.
2627
const auto *NewExpr = Result.Nodes.getNodeAs<CXXNewExpr>("new");
@@ -61,4 +62,4 @@ void DefaultOperatorNewAlignmentCheck::check(
6162
<< (SpecifiedAlignment / CharWidth);
6263
}
6364

64-
} // namespace clang::tidy::cert
65+
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.h renamed to clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H
1111

1212
#include "../ClangTidyCheck.h"
1313

14-
namespace clang::tidy::cert {
14+
namespace clang::tidy::bugprone {
1515

1616
/// Checks if an object of type with extended alignment is allocated by using
1717
/// the default operator new.
1818
///
1919
/// For the user-facing documentation see:
20-
/// https://clang.llvm.org/extra/clang-tidy/checks/cert/mem57-cpp.html
21-
class DefaultOperatorNewAlignmentCheck : public ClangTidyCheck {
20+
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/bugprone-default-operator-new-on-overaligned-type.html
21+
class DefaultOperatorNewOnOveralignedTypeCheck : public ClangTidyCheck {
2222
public:
23-
DefaultOperatorNewAlignmentCheck(StringRef Name, ClangTidyContext *Context)
23+
DefaultOperatorNewOnOveralignedTypeCheck(StringRef Name,
24+
ClangTidyContext *Context)
2425
: ClangTidyCheck(Name, Context) {}
2526
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
2627
return !LangOpts.CPlusPlus17;
@@ -29,6 +30,6 @@ class DefaultOperatorNewAlignmentCheck : public ClangTidyCheck {
2930
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3031
};
3132

32-
} // namespace clang::tidy::cert
33+
} // namespace clang::tidy::bugprone
3334

34-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H
35+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H

0 commit comments

Comments
 (0)