Skip to content

Commit 1a1172e

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-print-metadata
2 parents 6cf1ed5 + ce92582 commit 1a1172e

File tree

390 files changed

+9641
-9370
lines changed

Some content is hidden

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

390 files changed

+9641
-9370
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__":

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace clang::tidy::bugprone {
2020

2121
namespace {
2222

23+
// Preserve same name as AST_MATCHER(isCompleteAndHasNoZeroValue)
24+
// NOLINTNEXTLINE(llvm-prefer-static-over-anonymous-namespace)
2325
bool isCompleteAndHasNoZeroValue(const EnumDecl *D) {
2426
const EnumDecl *Definition = D->getDefinition();
2527
return Definition && Definition->isComplete() &&

clang-tools-extra/clang-tidy/cert/NonTrivialTypesLibcMemoryCallsCheck.cpp renamed to clang-tools-extra/clang-tidy/bugprone/RawMemoryCallOnNonTrivialTypeCheck.cpp

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

9-
#include "NonTrivialTypesLibcMemoryCallsCheck.h"
9+
#include "RawMemoryCallOnNonTrivialTypeCheck.h"
1010
#include "../utils/OptionsUtils.h"
1111
#include "clang/AST/Decl.h"
1212
#include "clang/ASTMatchers/ASTMatchFinder.h"
@@ -17,7 +17,7 @@
1717

1818
using namespace clang::ast_matchers;
1919

20-
namespace clang::tidy::cert {
20+
namespace clang::tidy::bugprone {
2121

2222
namespace {
2323
AST_MATCHER(CXXRecordDecl, isTriviallyDefaultConstructible) {
@@ -48,22 +48,21 @@ static constexpr llvm::StringRef ComparisonOperators[] = {
4848
"operator==", "operator!=", "operator<",
4949
"operator>", "operator<=", "operator>="};
5050

51-
NonTrivialTypesLibcMemoryCallsCheck::NonTrivialTypesLibcMemoryCallsCheck(
51+
RawMemoryCallOnNonTrivialTypeCheck::RawMemoryCallOnNonTrivialTypeCheck(
5252
StringRef Name, ClangTidyContext *Context)
5353
: ClangTidyCheck(Name, Context),
5454
MemSetNames(Options.get("MemSetNames", "")),
5555
MemCpyNames(Options.get("MemCpyNames", "")),
5656
MemCmpNames(Options.get("MemCmpNames", "")) {}
5757

58-
void NonTrivialTypesLibcMemoryCallsCheck::storeOptions(
58+
void RawMemoryCallOnNonTrivialTypeCheck::storeOptions(
5959
ClangTidyOptions::OptionMap &Opts) {
6060
Options.store(Opts, "MemSetNames", MemSetNames);
6161
Options.store(Opts, "MemCpyNames", MemCpyNames);
6262
Options.store(Opts, "MemCmpNames", MemCmpNames);
6363
}
6464

65-
void NonTrivialTypesLibcMemoryCallsCheck::registerMatchers(
66-
MatchFinder *Finder) {
65+
void RawMemoryCallOnNonTrivialTypeCheck::registerMatchers(MatchFinder *Finder) {
6766
using namespace ast_matchers::internal;
6867
auto IsStructPointer = [](Matcher<CXXRecordDecl> Constraint = anything(),
6968
bool Bind = false) {
@@ -103,7 +102,7 @@ void NonTrivialTypesLibcMemoryCallsCheck::registerMatchers(
103102
this);
104103
}
105104

106-
void NonTrivialTypesLibcMemoryCallsCheck::check(
105+
void RawMemoryCallOnNonTrivialTypeCheck::check(
107106
const MatchFinder::MatchResult &Result) {
108107
if (const auto *Caller = Result.Nodes.getNodeAs<CallExpr>("lazyConstruct")) {
109108
diag(Caller->getBeginLoc(), "calling %0 on a non-trivially default "
@@ -122,4 +121,4 @@ void NonTrivialTypesLibcMemoryCallsCheck::check(
122121
}
123122
}
124123

125-
} // namespace clang::tidy::cert
124+
} // namespace clang::tidy::bugprone

0 commit comments

Comments
 (0)