Skip to content

Commit b937a71

Browse files
authored
merge main into amd-staging (#781)
2 parents bff3fea + 4534986 commit b937a71

File tree

96 files changed

+1948
-1248
lines changed

Some content is hidden

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

96 files changed

+1948
-1248
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ Checks: >
99
-bugprone-narrowing-conversions,
1010
-bugprone-unchecked-optional-access,
1111
-bugprone-unused-return-value,
12+
cppcoreguidelines-init-variables,
13+
cppcoreguidelines-missing-std-forward,
14+
cppcoreguidelines-rvalue-reference-param-not-moved,
15+
cppcoreguidelines-virtual-class-destructor,
16+
google-readability-casting,
1217
misc-const-correctness,
1318
modernize-*,
1419
-modernize-avoid-c-arrays,

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ void ClangTidyDiagnosticConsumer::forwardDiagnostic(const Diagnostic &Info) {
526526
Builder << Qualifiers::fromOpaqueValue(Info.getRawArg(Index));
527527
break;
528528
case clang::DiagnosticsEngine::ak_qualtype:
529-
Builder << QualType::getFromOpaquePtr((void *)Info.getRawArg(Index));
529+
Builder << QualType::getFromOpaquePtr(
530+
reinterpret_cast<void *>(Info.getRawArg(Index)));
530531
break;
531532
case clang::DiagnosticsEngine::ak_declarationname:
532533
Builder << DeclarationName::getFromOpaqueInteger(Info.getRawArg(Index));

clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "clang/Basic/SourceManager.h"
2020
#include "clang/Tooling/Core/Diagnostic.h"
2121
#include "llvm/ADT/STLExtras.h"
22-
#include "llvm/ADT/SmallVector.h"
2322
#include "llvm/ADT/StringExtras.h"
2423
#include "llvm/ADT/StringMap.h"
2524
#include "llvm/ADT/StringSwitch.h"

clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
6363
const QualType StructFieldTy = StructField->getType();
6464
if (StructFieldTy->isIncompleteType())
6565
return;
66-
const unsigned int StructFieldWidth =
67-
(unsigned int)Result.Context->getTypeInfo(StructFieldTy.getTypePtr())
68-
.Width;
66+
const unsigned int StructFieldWidth = static_cast<unsigned int>(
67+
Result.Context->getTypeInfo(StructFieldTy.getTypePtr()).Width);
6968
FieldSizes.emplace_back(StructFieldWidth, StructField->getFieldIndex());
7069
// FIXME: Recommend a reorganization of the struct (sort by StructField
7170
// size, largest to smallest).
@@ -79,7 +78,7 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
7978
CharUnits::fromQuantity(std::max<clang::CharUnits::QuantityType>(
8079
std::ceil(static_cast<float>(TotalBitSize) / CharSize), 1));
8180
const CharUnits MaxAlign = CharUnits::fromQuantity(
82-
std::ceil((float)Struct->getMaxAlignment() / CharSize));
81+
std::ceil(static_cast<float>(Struct->getMaxAlignment()) / CharSize));
8382
const CharUnits CurrAlign =
8483
Result.Context->getASTRecordLayout(Struct).getAlignment();
8584
const CharUnits NewAlign = computeRecommendedAlignment(MinByteSize);
@@ -99,8 +98,7 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
9998
diag(Struct->getLocation(),
10099
"accessing fields in struct %0 is inefficient due to padding; only "
101100
"needs %1 bytes but is using %2 bytes")
102-
<< Struct << (int)MinByteSize.getQuantity()
103-
<< (int)CurrSize.getQuantity()
101+
<< Struct << MinByteSize.getQuantity() << CurrSize.getQuantity()
104102
<< FixItHint::CreateInsertion(Struct->getEndLoc().getLocWithOffset(1),
105103
" __attribute__((packed))");
106104
diag(Struct->getLocation(),
@@ -112,8 +110,7 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
112110

113111
FixItHint FixIt;
114112
auto *Attribute = Struct->getAttr<AlignedAttr>();
115-
const std::string NewAlignQuantity =
116-
std::to_string((int)NewAlign.getQuantity());
113+
const std::string NewAlignQuantity = std::to_string(NewAlign.getQuantity());
117114
if (Attribute) {
118115
FixIt = FixItHint::CreateReplacement(
119116
Attribute->getRange(),
@@ -130,7 +127,7 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
130127
diag(Struct->getLocation(),
131128
"accessing fields in struct %0 is inefficient due to poor alignment; "
132129
"currently aligned to %1 bytes, but recommended alignment is %2 bytes")
133-
<< Struct << (int)CurrAlign.getQuantity() << NewAlignQuantity << FixIt;
130+
<< Struct << CurrAlign.getQuantity() << NewAlignQuantity << FixIt;
134131

135132
diag(Struct->getLocation(),
136133
"use \"__attribute__((aligned(%0)))\" to align struct %1 to %0 bytes",

clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,22 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement,
208208
return true;
209209
switch (Op->getOpcode()) {
210210
case (BO_AddAssign):
211-
Iterations = std::ceil(float(EndValue - InitValue) / ConstantValue);
211+
Iterations =
212+
std::ceil(static_cast<float>(EndValue - InitValue) / ConstantValue);
212213
break;
213214
case (BO_SubAssign):
214-
Iterations = std::ceil(float(InitValue - EndValue) / ConstantValue);
215+
Iterations =
216+
std::ceil(static_cast<float>(InitValue - EndValue) / ConstantValue);
215217
break;
216218
case (BO_MulAssign):
217-
Iterations =
218-
1 + ((std::log((double)EndValue) - std::log((double)InitValue)) /
219-
std::log((double)ConstantValue));
219+
Iterations = 1 + ((std::log(static_cast<double>(EndValue)) -
220+
std::log(static_cast<double>(InitValue))) /
221+
std::log(static_cast<double>(ConstantValue)));
220222
break;
221223
case (BO_DivAssign):
222-
Iterations =
223-
1 + ((std::log((double)InitValue) - std::log((double)EndValue)) /
224-
std::log((double)ConstantValue));
224+
Iterations = 1 + ((std::log(static_cast<double>(InitValue)) -
225+
std::log(static_cast<double>(EndValue))) /
226+
std::log(static_cast<double>(ConstantValue)));
225227
break;
226228
default:
227229
// All other operators are not handled; assume large bounds.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
1212
#include "llvm/ADT/SmallString.h"
1313
#include "llvm/ADT/SmallVector.h"
14-
#include <algorithm>
1514

1615
using namespace clang::ast_matchers;
1716

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "DanglingHandleCheck.h"
10-
#include "../utils/Matchers.h"
1110
#include "../utils/OptionsUtils.h"
1211
#include "clang/AST/ASTContext.h"
1312
#include "clang/ASTMatchers/ASTMatchFinder.h"
1413

1514
using namespace clang::ast_matchers;
16-
using namespace clang::tidy::matchers;
1715

1816
namespace clang::tidy::bugprone {
1917

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "../utils/OptionsUtils.h"
1212
#include "clang/AST/ASTContext.h"
1313
#include "clang/ASTMatchers/ASTMatchFinder.h"
14-
#include <algorithm>
1514

1615
using namespace clang::ast_matchers;
1716

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void SuspiciousMissingCommaCheck::check(
116116

117117
// Warn only when concatenation is not common in this initializer list.
118118
// The current threshold is set to less than 1/5 of the string literals.
119-
if (double(Count) / Size > RatioThreshold)
119+
if (static_cast<double>(Count) / Size > RatioThreshold)
120120
return;
121121

122122
diag(ConcatenatedLiteral->getBeginLoc(),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ void UnsafeFunctionsCheck::registerMatchers(MatchFinder *Finder) {
266266
}
267267

268268
void UnsafeFunctionsCheck::check(const MatchFinder::MatchResult &Result) {
269-
const Expr *SourceExpr;
270-
const FunctionDecl *FuncDecl;
269+
const Expr *SourceExpr = nullptr;
270+
const FunctionDecl *FuncDecl = nullptr;
271271

272272
if (const auto *DeclRef = Result.Nodes.getNodeAs<DeclRefExpr>(DeclRefId)) {
273273
SourceExpr = DeclRef;

0 commit comments

Comments
 (0)