Skip to content

Commit a62b47b

Browse files
committed
merge main into amd-staging
Change-Id: I0cc53e0daedd726ac67642acaf51a86b9bae8c6c
2 parents 4a38ce8 + 77ef5a6 commit a62b47b

File tree

169 files changed

+1764
-1112
lines changed

Some content is hidden

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

169 files changed

+1764
-1112
lines changed

.github/workflows/spirv-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
build_target: check-llvm-codegen-spirv
2727
projects:
2828
extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
29-
os_list: '["ubuntu-latest"]'
29+
os_list: '["ubuntu-22.04"]'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AST_MATCHER(FieldDecl, hasIntBitwidth) {
3838
assert(Node.isBitField());
3939
const ASTContext &Ctx = Node.getASTContext();
4040
unsigned IntBitWidth = Ctx.getIntWidth(Ctx.IntTy);
41-
unsigned CurrentBitWidth = Node.getBitWidthValue(Ctx);
41+
unsigned CurrentBitWidth = Node.getBitWidthValue();
4242
return IntBitWidth == CurrentBitWidth;
4343
}
4444

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static MagnitudeBits calcMagnitudeBits(const ASTContext &Context,
124124
unsigned SignedBits = IntExprType->isUnsignedIntegerType() ? 0U : 1U;
125125

126126
if (const auto *BitField = IntExpr->getSourceBitField()) {
127-
unsigned BitFieldWidth = BitField->getBitWidthValue(Context);
127+
unsigned BitFieldWidth = BitField->getBitWidthValue();
128128
return {BitFieldWidth - SignedBits, BitFieldWidth};
129129
}
130130

clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void MultiwayPathsCoveredCheck::handleSwitchWithoutDefault(
160160
}
161161
if (const auto *BitfieldDecl =
162162
Result.Nodes.getNodeAs<FieldDecl>("bitfield")) {
163-
return twoPow(BitfieldDecl->getBitWidthValue(*Result.Context));
163+
return twoPow(BitfieldDecl->getBitWidthValue());
164164
}
165165

166166
return static_cast<std::size_t>(0);

clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ namespace clang::tidy::readability {
1919
///
2020
/// The emptiness of a container should be checked using the `empty()` method
2121
/// instead of the `size()`/`length()` method. It shows clearer intent to use
22-
/// `empty()`. Furthermore some containers may implement the `empty()` method
23-
/// but not implement the `size()` or `length()` method. Using `empty()`
24-
/// whenever possible makes it easier to switch to another container in the
25-
/// future.
22+
/// `empty()`. Furthermore some containers (for example, a `std::forward_list`)
23+
/// may implement the `empty()` method but not implement the `size()` or
24+
/// `length()` method. Using `empty()` whenever possible makes it easier to
25+
/// switch to another container in the future.
2626
class ContainerSizeEmptyCheck : public ClangTidyCheck {
2727
public:
2828
ContainerSizeEmptyCheck(StringRef Name, ClangTidyContext *Context);

clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ void RedundantCastingCheck::registerMatchers(MatchFinder *Finder) {
108108

109109
auto BitfieldMemberExpr = memberExpr(member(fieldDecl(isBitField())));
110110

111+
const ast_matchers::internal::VariadicDynCastAllOfMatcher<
112+
Stmt, CXXParenListInitExpr>
113+
cxxParenListInitExpr; // NOLINT(readability-identifier-naming)
114+
111115
Finder->addMatcher(
112116
explicitCastExpr(
113117
unless(hasCastKind(CK_ConstructorConversion)),
@@ -117,6 +121,7 @@ void RedundantCastingCheck::registerMatchers(MatchFinder *Finder) {
117121
hasDestinationType(qualType().bind("dstType")),
118122
hasSourceExpression(anyOf(
119123
expr(unless(initListExpr()), unless(BitfieldMemberExpr),
124+
unless(cxxParenListInitExpr()),
120125
hasType(qualType().bind("srcType")))
121126
.bind("source"),
122127
initListExpr(unless(hasInit(1, expr())),

clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,27 @@ static QualType getNonTemplateAlias(QualType QT) {
7979
return QT;
8080
}
8181

82+
static QualType getReplacementCastType(const Expr *CondLhs, const Expr *CondRhs,
83+
QualType ComparedType) {
84+
QualType LhsType = CondLhs->getType();
85+
QualType RhsType = CondRhs->getType();
86+
QualType LhsCanonicalType =
87+
LhsType.getCanonicalType().getNonReferenceType().getUnqualifiedType();
88+
QualType RhsCanonicalType =
89+
RhsType.getCanonicalType().getNonReferenceType().getUnqualifiedType();
90+
QualType GlobalImplicitCastType;
91+
if (LhsCanonicalType != RhsCanonicalType) {
92+
if (llvm::isa<IntegerLiteral>(CondRhs)) {
93+
GlobalImplicitCastType = getNonTemplateAlias(LhsType);
94+
} else if (llvm::isa<IntegerLiteral>(CondLhs)) {
95+
GlobalImplicitCastType = getNonTemplateAlias(RhsType);
96+
} else {
97+
GlobalImplicitCastType = getNonTemplateAlias(ComparedType);
98+
}
99+
}
100+
return GlobalImplicitCastType;
101+
}
102+
82103
static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs,
83104
const Expr *AssignLhs,
84105
const SourceManager &Source,
@@ -92,18 +113,8 @@ static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs,
92113
const llvm::StringRef AssignLhsStr = Lexer::getSourceText(
93114
Source.getExpansionRange(AssignLhs->getSourceRange()), Source, LO);
94115

95-
QualType GlobalImplicitCastType;
96-
QualType LhsType = CondLhs->getType()
97-
.getCanonicalType()
98-
.getNonReferenceType()
99-
.getUnqualifiedType();
100-
QualType RhsType = CondRhs->getType()
101-
.getCanonicalType()
102-
.getNonReferenceType()
103-
.getUnqualifiedType();
104-
if (LhsType != RhsType) {
105-
GlobalImplicitCastType = getNonTemplateAlias(BO->getLHS()->getType());
106-
}
116+
QualType GlobalImplicitCastType =
117+
getReplacementCastType(CondLhs, CondRhs, BO->getLHS()->getType());
107118

108119
return (AssignLhsStr + " = " + FunctionName +
109120
(!GlobalImplicitCastType.isNull()

clang-tools-extra/clangd/Hover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ void addLayoutInfo(const NamedDecl &ND, HoverInfo &HI) {
10181018
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(Record);
10191019
HI.Offset = Layout.getFieldOffset(FD->getFieldIndex());
10201020
if (FD->isBitField())
1021-
HI.Size = FD->getBitWidthValue(Ctx);
1021+
HI.Size = FD->getBitWidthValue();
10221022
else if (auto Size = Ctx.getTypeSizeInCharsIfKnown(FD->getType()))
10231023
HI.Size = FD->isZeroSize(Ctx) ? 0 : Size->getQuantity() * 8;
10241024
if (HI.Size) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,19 @@ Changes in existing checks
360360
case of the literal suffix in fixes and fixing false positive for implicit
361361
conversion of comparison result in C23.
362362

363+
- Improved :doc:`readability-redundant-casting
364+
<clang-tidy/checks/readability/redundant-casting>` check
365+
by addressing a false positive in aggregate initialization through
366+
parenthesized list.
367+
363368
- Improved :doc:`readability-redundant-smartptr-get
364369
<clang-tidy/checks/readability/redundant-smartptr-get>` check to
365370
remove `->`, when redundant `get()` is removed.
366371

372+
- Improved :doc:`readability-use-std-min-max
373+
<clang-tidy/checks/readability/use-std-min-max>` check to use correct template
374+
type in ``std::min`` and ``std::max`` when operand is integer literal.
375+
367376
Removed checks
368377
^^^^^^^^^^^^^^
369378

clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ with a call to ``empty()``.
99

1010
The emptiness of a container should be checked using the ``empty()`` method
1111
instead of the ``size()``/``length()`` method. It shows clearer intent to use
12-
``empty()``. Furthermore some containers may implement the ``empty()`` method
13-
but not implement the ``size()`` or ``length()`` method. Using ``empty()``
14-
whenever possible makes it easier to switch to another container in the future.
12+
``empty()``. Furthermore some containers (for example, a ``std::forward_list``)
13+
may implement the ``empty()`` method but not implement the ``size()`` or
14+
``length()`` method. Using ``empty()`` whenever possible makes it easier to
15+
switch to another container in the future.
1516

1617
The check issues warning if a container has ``empty()`` and ``size()`` or
1718
``length()`` methods matching following signatures:

0 commit comments

Comments
 (0)