Skip to content

Commit fc7d919

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: Iecb1b14fcbee9f74590efbd8c542c0955490a3a5
2 parents 47b6a30 + a1eaed7 commit fc7d919

File tree

27 files changed

+303
-40
lines changed

27 files changed

+303
-40
lines changed

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ writeFileDefinition(const Location &L,
457457
Node->Children.emplace_back(std::make_unique<TextNode>(" of file "));
458458
auto LocFileNode = std::make_unique<TagNode>(
459459
HTMLTag::TAG_A, llvm::sys::path::filename(FileURL));
460-
LocFileNode->Attributes.emplace_back("href", std::string(FileURL.str()));
460+
LocFileNode->Attributes.emplace_back("href", std::string(FileURL));
461461
Node->Children.emplace_back(std::move(LocFileNode));
462462
return Node;
463463
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ namespace clang::tidy {
1616
// from the GlobList.
1717
static bool consumeNegativeIndicator(StringRef &GlobList) {
1818
GlobList = GlobList.trim();
19-
if (GlobList.starts_with("-")) {
20-
GlobList = GlobList.substr(1);
21-
return true;
22-
}
23-
return false;
19+
return GlobList.consume_front("-");
2420
}
2521

2622
// Converts first glob from the comma-separated list of globs to Regex and

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
274274
allOf(anyOf(hasCastKind(CK_NullToPointer),
275275
hasCastKind(CK_NullToMemberPointer)),
276276
hasSourceExpression(cxxBoolLiteral()))),
277-
hasSourceExpression(expr(hasType(booleanType()))),
278-
unless(ExceptionCases));
277+
hasSourceExpression(expr(hasType(booleanType()))));
279278
auto BoolXor =
280279
binaryOperator(hasOperatorName("^"), hasLHS(ImplicitCastFromBool),
281280
hasRHS(ImplicitCastFromBool));
@@ -315,7 +314,7 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
315314
traverse(
316315
TK_AsIs,
317316
implicitCastExpr(
318-
ImplicitCastFromBool,
317+
ImplicitCastFromBool, unless(ExceptionCases),
319318
// Exclude comparisons of bools, as they are always cast to
320319
// integers in such context:
321320
// bool_expr_a == bool_expr_b

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ Changes in existing checks
493493
<clang-tidy/checks/readability/implicit-bool-conversion>` check to take
494494
do-while loops into account for the `AllowIntegerConditions` and
495495
`AllowPointerConditions` options. It also now provides more consistent
496-
suggestions when parentheses are added to the return value.
496+
suggestions when parentheses are added to the return value. It also ignores
497+
false-positives for comparison containing bool bitfield.
497498

498499
- Improved :doc:`readability-misleading-indentation
499500
<clang-tidy/checks/readability/misleading-indentation>` check to ignore

clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-allow-in-conditions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ int* functionReturningPointer();
1212
struct Struct {
1313
int member;
1414
unsigned bitfield : 1;
15+
bool boolfield : 1;
1516
};
1617

1718

@@ -28,6 +29,8 @@ void implicitConversionIntegerToBoolInConditionalsIsAllowed() {
2829
if (!s.member) {}
2930
if (s.bitfield) {}
3031
if (!s.bitfield) {}
32+
if (s.boolfield == true) {}
33+
if (s.boolfield != true) {}
3134
if (functionReturningInt()) {}
3235
if (!functionReturningInt()) {}
3336
if (functionReturningInt() && functionReturningPointer()) {}

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4432,6 +4432,11 @@ the configuration (without a prefix: ``Auto``).
44324432
**PenaltyBreakOpenParenthesis** (``Unsigned``) :versionbadge:`clang-format 14` :ref:`<PenaltyBreakOpenParenthesis>`
44334433
The penalty for breaking after ``(``.
44344434

4435+
.. _PenaltyBreakScopeResolution:
4436+
4437+
**PenaltyBreakScopeResolution** (``Unsigned``) :versionbadge:`clang-format 18` :ref:`<PenaltyBreakScopeResolution>`
4438+
The penalty for breaking after ``::``.
4439+
44354440
.. _PenaltyBreakString:
44364441

44374442
**PenaltyBreakString** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`<PenaltyBreakString>`

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ clang-format
11891189
- Add ``BreakAdjacentStringLiterals`` option.
11901190
- Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
11911191
attributes (like ``nonatomic, strong, nullable``).
1192+
- Add ``PenaltyBreakScopeResolution`` option.
11921193
- Add ``.clang-format-ignore`` files.
11931194
- Add ``AlignFunctionPointers`` sub-option for ``AlignConsecutiveDeclarations``.
11941195

clang/include/clang/Format/Format.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,6 +3398,10 @@ struct FormatStyle {
33983398
/// \version 14
33993399
unsigned PenaltyBreakOpenParenthesis;
34003400

3401+
/// The penalty for breaking after ``::``.
3402+
/// \version 18
3403+
unsigned PenaltyBreakScopeResolution;
3404+
34013405
/// The penalty for each line break introduced inside a string literal.
34023406
/// \version 3.7
34033407
unsigned PenaltyBreakString;
@@ -4873,6 +4877,7 @@ struct FormatStyle {
48734877
PenaltyBreakComment == R.PenaltyBreakComment &&
48744878
PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess &&
48754879
PenaltyBreakOpenParenthesis == R.PenaltyBreakOpenParenthesis &&
4880+
PenaltyBreakScopeResolution == R.PenaltyBreakScopeResolution &&
48764881
PenaltyBreakString == R.PenaltyBreakString &&
48774882
PenaltyBreakTemplateDeclaration ==
48784883
R.PenaltyBreakTemplateDeclaration &&

clang/lib/Format/Format.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,8 @@ template <> struct MappingTraits<FormatStyle> {
10541054
Style.PenaltyBreakFirstLessLess);
10551055
IO.mapOptional("PenaltyBreakOpenParenthesis",
10561056
Style.PenaltyBreakOpenParenthesis);
1057+
IO.mapOptional("PenaltyBreakScopeResolution",
1058+
Style.PenaltyBreakScopeResolution);
10571059
IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString);
10581060
IO.mapOptional("PenaltyBreakTemplateDeclaration",
10591061
Style.PenaltyBreakTemplateDeclaration);
@@ -1602,6 +1604,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
16021604
LLVMStyle.PenaltyReturnTypeOnItsOwnLine = 60;
16031605
LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
16041606
LLVMStyle.PenaltyBreakOpenParenthesis = 0;
1607+
LLVMStyle.PenaltyBreakScopeResolution = 500;
16051608
LLVMStyle.PenaltyBreakTemplateDeclaration = prec::Relational;
16061609
LLVMStyle.PenaltyIndentedWhitespace = 0;
16071610

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3765,7 +3765,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
37653765
}
37663766

37673767
if (Left.is(tok::coloncolon))
3768-
return 500;
3768+
return Style.PenaltyBreakScopeResolution;
37693769
if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
37703770
Right.is(tok::kw_operator)) {
37713771
if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)

0 commit comments

Comments
 (0)