Skip to content

Commit 4ee2445

Browse files
authored
merge main into amd-staging (#470)
2 parents dbc7b80 + b46e1c2 commit 4ee2445

File tree

213 files changed

+1203
-714
lines changed

Some content is hidden

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

213 files changed

+1203
-714
lines changed

.ci/generate_test_report_lib_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
407407
]
408408
],
409409
)
410-
print(test)
411410
self.assertEqual(
412411
generate_test_report_lib.generate_report(
413412
"Foo",

.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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "ParentVirtualCallCheck.h"
6262
#include "PointerArithmeticOnPolymorphicObjectCheck.h"
6363
#include "PosixReturnCheck.h"
64+
#include "RawMemoryCallOnNonTrivialTypeCheck.h"
6465
#include "RedundantBranchConditionCheck.h"
6566
#include "ReservedIdentifierCheck.h"
6667
#include "ReturnConstRefFromParameterCheck.h"
@@ -216,6 +217,8 @@ class BugproneModule : public ClangTidyModule {
216217
CheckFactories.registerCheck<ParentVirtualCallCheck>(
217218
"bugprone-parent-virtual-call");
218219
CheckFactories.registerCheck<PosixReturnCheck>("bugprone-posix-return");
220+
CheckFactories.registerCheck<RawMemoryCallOnNonTrivialTypeCheck>(
221+
"bugprone-raw-memory-call-on-non-trivial-type");
219222
CheckFactories.registerCheck<ReservedIdentifierCheck>(
220223
"bugprone-reserved-identifier");
221224
CheckFactories.registerCheck<SharedPtrArrayMismatchCheck>(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ add_clang_library(clangTidyBugproneModule STATIC
6262
ParentVirtualCallCheck.cpp
6363
PointerArithmeticOnPolymorphicObjectCheck.cpp
6464
PosixReturnCheck.cpp
65+
RawMemoryCallOnNonTrivialTypeCheck.cpp
6566
RedundantBranchConditionCheck.cpp
6667
ReservedIdentifierCheck.cpp
6768
ReturnConstRefFromParameterCheck.cpp

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

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

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

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_NONTRIVIALTYPESLIBCMEMORYCALLSCHECK_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_NONTRIVIALTYPESLIBCMEMORYCALLSCHECK_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H
1111

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

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

16-
/// Flags use of the `C` standard library functions 'memset', 'memcpy' and
16+
/// Flags use of the C standard library functions 'memset', 'memcpy' and
1717
/// 'memcmp' and similar derivatives on non-trivial types.
1818
///
1919
/// For the user-facing documentation see:
20-
/// https://clang.llvm.org/extra/clang-tidy/checks/cert/oop57-cpp.html
21-
class NonTrivialTypesLibcMemoryCallsCheck : public ClangTidyCheck {
20+
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/raw-memory-call-on-non-trivial-type.html
21+
class RawMemoryCallOnNonTrivialTypeCheck : public ClangTidyCheck {
2222
public:
23-
NonTrivialTypesLibcMemoryCallsCheck(StringRef Name,
24-
ClangTidyContext *Context);
23+
RawMemoryCallOnNonTrivialTypeCheck(StringRef Name, ClangTidyContext *Context);
2524
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
2625
return LangOpts.CPlusPlus && !LangOpts.ObjC;
2726
}
@@ -35,6 +34,6 @@ class NonTrivialTypesLibcMemoryCallsCheck : public ClangTidyCheck {
3534
const StringRef MemCmpNames;
3635
};
3736

38-
} // namespace clang::tidy::cert
37+
} // namespace clang::tidy::bugprone
3938

40-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_NONTRIVIALTYPESLIBCMEMORYCALLSCHECK_H
39+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ using namespace clang::ast_matchers;
1515

1616
namespace clang::tidy::bugprone {
1717

18-
namespace {
18+
static constexpr char ConstructExprN[] = "found_construct_expr";
19+
static constexpr char NewExprN[] = "found_new_expr";
20+
static constexpr char ConstructorN[] = "found_constructor";
1921

20-
constexpr char ConstructExprN[] = "found_construct_expr";
21-
constexpr char NewExprN[] = "found_new_expr";
22-
constexpr char ConstructorN[] = "found_constructor";
23-
24-
bool isInSingleDeclStmt(const DeclaratorDecl *D) {
22+
static bool isInSingleDeclStmt(const DeclaratorDecl *D) {
2523
const DynTypedNodeList Parents =
2624
D->getASTContext().getParentMapContext().getParents(*D);
2725
for (const DynTypedNode &PNode : Parents)
@@ -30,8 +28,8 @@ bool isInSingleDeclStmt(const DeclaratorDecl *D) {
3028
return false;
3129
}
3230

33-
const DeclaratorDecl *getConstructedVarOrField(const Expr *FoundConstructExpr,
34-
ASTContext &Ctx) {
31+
static const DeclaratorDecl *
32+
getConstructedVarOrField(const Expr *FoundConstructExpr, ASTContext &Ctx) {
3533
const DynTypedNodeList ConstructParents =
3634
Ctx.getParentMapContext().getParents(*FoundConstructExpr);
3735
if (ConstructParents.size() != 1)
@@ -43,8 +41,6 @@ const DeclaratorDecl *getConstructedVarOrField(const Expr *FoundConstructExpr,
4341
return nullptr;
4442
}
4543

46-
} // namespace
47-
4844
const char SmartPtrArrayMismatchCheck::PointerTypeN[] = "pointer_type";
4945

5046
SmartPtrArrayMismatchCheck::SmartPtrArrayMismatchCheck(

clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../bugprone/BadSignalToKillThreadCheck.h"
1313
#include "../bugprone/CommandProcessorCheck.h"
1414
#include "../bugprone/PointerArithmeticOnPolymorphicObjectCheck.h"
15+
#include "../bugprone/RawMemoryCallOnNonTrivialTypeCheck.h"
1516
#include "../bugprone/ReservedIdentifierCheck.h"
1617
#include "../bugprone/SignalHandlerCheck.h"
1718
#include "../bugprone/SignedCharMisuseCheck.h"
@@ -39,7 +40,6 @@
3940
#include "FloatLoopCounter.h"
4041
#include "LimitedRandomnessCheck.h"
4142
#include "MutatingCopyCheck.h"
42-
#include "NonTrivialTypesLibcMemoryCallsCheck.h"
4343
#include "ProperlySeededRandomGeneratorCheck.h"
4444
#include "ThrownExceptionTypeCheck.h"
4545

@@ -278,7 +278,7 @@ class CERTModule : public ClangTidyModule {
278278
"cert-oop11-cpp");
279279
CheckFactories.registerCheck<bugprone::UnhandledSelfAssignmentCheck>(
280280
"cert-oop54-cpp");
281-
CheckFactories.registerCheck<NonTrivialTypesLibcMemoryCallsCheck>(
281+
CheckFactories.registerCheck<bugprone::RawMemoryCallOnNonTrivialTypeCheck>(
282282
"cert-oop57-cpp");
283283
CheckFactories.registerCheck<MutatingCopyCheck>("cert-oop58-cpp");
284284

0 commit comments

Comments
 (0)