Skip to content

Commit 09be8bf

Browse files
committed
Merge branch 'main' into dealloc-vgprs
2 parents 9b23c97 + 9d0616c commit 09be8bf

File tree

258 files changed

+5084
-1077
lines changed

Some content is hidden

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

258 files changed

+5084
-1077
lines changed

bolt/include/bolt/Core/DIEBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class DIEBuilder {
314314

315315
BC.errs()
316316
<< "BOLT-ERROR: unable to find TypeUnit for Type Unit at offset 0x"
317-
<< DU.getOffset() << "\n";
317+
<< Twine::utohexstr(DU.getOffset()) << "\n";
318318
return nullptr;
319319
}
320320

bolt/lib/Core/BinaryContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,8 +1294,8 @@ bool BinaryContext::handleAArch64Veneer(uint64_t Address, bool MatchOnly) {
12941294
Veneer->getOrCreateLocalLabel(Address);
12951295
Veneer->setMaxSize(TotalSize);
12961296
Veneer->updateState(BinaryFunction::State::Disassembled);
1297-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: handling veneer function at 0x" << Address
1298-
<< "\n");
1297+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: handling veneer function at 0x"
1298+
<< Twine::utohexstr(Address) << "\n");
12991299
return true;
13001300
};
13011301

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ void DWARFRewriter::updateDWARFObjectAddressRanges(
13621362
Die.getTag() == dwarf::DW_TAG_compile_unit)) {
13631363
if (opts::Verbosity >= 1)
13641364
errs() << "BOLT-WARNING: cannot update ranges for DIE in Unit offset 0x"
1365-
<< Unit.getOffset() << '\n';
1365+
<< Twine::utohexstr(Unit.getOffset()) << '\n';
13661366
}
13671367
}
13681368

clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include "UseStartsEndsWithCheck.h"
1010

1111
#include "../utils/ASTUtils.h"
12-
#include "../utils/OptionsUtils.h"
12+
#include "../utils/Matchers.h"
13+
#include "clang/ASTMatchers/ASTMatchers.h"
1314
#include "clang/Lex/Lexer.h"
1415

1516
#include <string>
@@ -82,60 +83,53 @@ UseStartsEndsWithCheck::UseStartsEndsWithCheck(StringRef Name,
8283
void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
8384
const auto ZeroLiteral = integerLiteral(equals(0));
8485

85-
const auto HasStartsWithMethodWithName = [](const std::string &Name) {
86-
return hasMethod(
87-
cxxMethodDecl(hasName(Name), isConst(), parameterCountIs(1))
88-
.bind("starts_with_fun"));
86+
const auto ClassTypeWithMethod = [](const StringRef MethodBoundName,
87+
const auto... Methods) {
88+
return cxxRecordDecl(anyOf(
89+
hasMethod(cxxMethodDecl(isConst(), parameterCountIs(1),
90+
returns(booleanType()), hasAnyName(Methods))
91+
.bind(MethodBoundName))...));
8992
};
90-
const auto HasStartsWithMethod =
91-
anyOf(HasStartsWithMethodWithName("starts_with"),
92-
HasStartsWithMethodWithName("startsWith"),
93-
HasStartsWithMethodWithName("startswith"));
93+
9494
const auto OnClassWithStartsWithFunction =
95-
on(hasType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
96-
anyOf(HasStartsWithMethod,
97-
hasAnyBase(hasType(hasCanonicalType(
98-
hasDeclaration(cxxRecordDecl(HasStartsWithMethod)))))))))));
99-
100-
const auto HasEndsWithMethodWithName = [](const std::string &Name) {
101-
return hasMethod(
102-
cxxMethodDecl(hasName(Name), isConst(), parameterCountIs(1))
103-
.bind("ends_with_fun"));
104-
};
105-
const auto HasEndsWithMethod = anyOf(HasEndsWithMethodWithName("ends_with"),
106-
HasEndsWithMethodWithName("endsWith"),
107-
HasEndsWithMethodWithName("endswith"));
108-
const auto OnClassWithEndsWithFunction =
109-
on(expr(hasType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
110-
anyOf(HasEndsWithMethod,
111-
hasAnyBase(hasType(hasCanonicalType(hasDeclaration(
112-
cxxRecordDecl(HasEndsWithMethod)))))))))))
113-
.bind("haystack"));
95+
ClassTypeWithMethod("starts_with_fun", "starts_with", "startsWith",
96+
"startswith", "StartsWith");
97+
98+
const auto OnClassWithEndsWithFunction = ClassTypeWithMethod(
99+
"ends_with_fun", "ends_with", "endsWith", "endswith", "EndsWith");
114100

115101
// Case 1: X.find(Y) [!=]= 0 -> starts_with.
116102
const auto FindExpr = cxxMemberCallExpr(
117103
anyOf(argumentCountIs(1), hasArgument(1, ZeroLiteral)),
118-
callee(cxxMethodDecl(hasName("find")).bind("find_fun")),
119-
OnClassWithStartsWithFunction, hasArgument(0, expr().bind("needle")));
104+
callee(
105+
cxxMethodDecl(hasName("find"), ofClass(OnClassWithStartsWithFunction))
106+
.bind("find_fun")),
107+
hasArgument(0, expr().bind("needle")));
120108

121109
// Case 2: X.rfind(Y, 0) [!=]= 0 -> starts_with.
122110
const auto RFindExpr = cxxMemberCallExpr(
123111
hasArgument(1, ZeroLiteral),
124-
callee(cxxMethodDecl(hasName("rfind")).bind("find_fun")),
125-
OnClassWithStartsWithFunction, hasArgument(0, expr().bind("needle")));
112+
callee(cxxMethodDecl(hasName("rfind"),
113+
ofClass(OnClassWithStartsWithFunction))
114+
.bind("find_fun")),
115+
hasArgument(0, expr().bind("needle")));
126116

127117
// Case 3: X.compare(0, LEN(Y), Y) [!=]= 0 -> starts_with.
128118
const auto CompareExpr = cxxMemberCallExpr(
129119
argumentCountIs(3), hasArgument(0, ZeroLiteral),
130-
callee(cxxMethodDecl(hasName("compare")).bind("find_fun")),
131-
OnClassWithStartsWithFunction, hasArgument(2, expr().bind("needle")),
120+
callee(cxxMethodDecl(hasName("compare"),
121+
ofClass(OnClassWithStartsWithFunction))
122+
.bind("find_fun")),
123+
hasArgument(2, expr().bind("needle")),
132124
hasArgument(1, lengthExprForStringNode("needle")));
133125

134126
// Case 4: X.compare(LEN(X) - LEN(Y), LEN(Y), Y) [!=]= 0 -> ends_with.
135127
const auto CompareEndsWithExpr = cxxMemberCallExpr(
136128
argumentCountIs(3),
137-
callee(cxxMethodDecl(hasName("compare")).bind("find_fun")),
138-
OnClassWithEndsWithFunction, hasArgument(2, expr().bind("needle")),
129+
callee(cxxMethodDecl(hasName("compare"),
130+
ofClass(OnClassWithEndsWithFunction))
131+
.bind("find_fun")),
132+
on(expr().bind("haystack")), hasArgument(2, expr().bind("needle")),
139133
hasArgument(1, lengthExprForStringNode("needle")),
140134
hasArgument(0,
141135
binaryOperator(hasOperatorName("-"),
@@ -145,7 +139,7 @@ void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
145139
// All cases comparing to 0.
146140
Finder->addMatcher(
147141
binaryOperator(
148-
hasAnyOperatorName("==", "!="),
142+
matchers::isEqualityOperator(),
149143
hasOperands(cxxMemberCallExpr(anyOf(FindExpr, RFindExpr, CompareExpr,
150144
CompareEndsWithExpr))
151145
.bind("find_expr"),
@@ -156,7 +150,7 @@ void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
156150
// Case 5: X.rfind(Y) [!=]= LEN(X) - LEN(Y) -> ends_with.
157151
Finder->addMatcher(
158152
binaryOperator(
159-
hasAnyOperatorName("==", "!="),
153+
matchers::isEqualityOperator(),
160154
hasOperands(
161155
cxxMemberCallExpr(
162156
anyOf(
@@ -166,8 +160,10 @@ void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
166160
1,
167161
anyOf(declRefExpr(to(varDecl(hasName("npos")))),
168162
memberExpr(member(hasName("npos"))))))),
169-
callee(cxxMethodDecl(hasName("rfind")).bind("find_fun")),
170-
OnClassWithEndsWithFunction,
163+
callee(cxxMethodDecl(hasName("rfind"),
164+
ofClass(OnClassWithEndsWithFunction))
165+
.bind("find_fun")),
166+
on(expr().bind("haystack")),
171167
hasArgument(0, expr().bind("needle")))
172168
.bind("find_expr"),
173169
binaryOperator(hasOperatorName("-"),
@@ -190,9 +186,8 @@ void UseStartsEndsWithCheck::check(const MatchFinder::MatchResult &Result) {
190186
const CXXMethodDecl *ReplacementFunction =
191187
StartsWithFunction ? StartsWithFunction : EndsWithFunction;
192188

193-
if (ComparisonExpr->getBeginLoc().isMacroID()) {
189+
if (ComparisonExpr->getBeginLoc().isMacroID())
194190
return;
195-
}
196191

197192
const bool Neg = ComparisonExpr->getOpcode() == BO_NE;
198193

@@ -220,9 +215,8 @@ void UseStartsEndsWithCheck::check(const MatchFinder::MatchResult &Result) {
220215
(ReplacementFunction->getName() + "(").str());
221216

222217
// Add possible negation '!'.
223-
if (Neg) {
218+
if (Neg)
224219
Diagnostic << FixItHint::CreateInsertion(FindExpr->getBeginLoc(), "!");
225-
}
226220
}
227221

228222
} // namespace clang::tidy::modernize

clang-tools-extra/test/clang-tidy/checkers/modernize/use-starts-ends-with.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@ struct prefer_underscore_version_flip {
3232
size_t find(const char *s, size_t pos = 0) const;
3333
};
3434

35-
struct prefer_underscore_version_inherit : public string_like {
36-
bool startsWith(const char *s) const;
37-
};
38-
3935
void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss,
4036
string_like sl, string_like_camel slc, prefer_underscore_version puv,
41-
prefer_underscore_version_flip puvf,
42-
prefer_underscore_version_inherit puvi) {
37+
prefer_underscore_version_flip puvf) {
4338
s.find("a") == 0;
4439
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of find() == 0
4540
// CHECK-FIXES: s.starts_with("a");
@@ -153,12 +148,6 @@ void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss,
153148
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with
154149
// CHECK-FIXES: puvf.starts_with("a");
155150

156-
// Here, the subclass has startsWith, the superclass has starts_with.
157-
// We prefer the version from the subclass.
158-
puvi.find("a") == 0;
159-
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use startsWith
160-
// CHECK-FIXES: puvi.startsWith("a");
161-
162151
s.compare(0, 1, "a") == 0;
163152
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of compare() == 0
164153
// CHECK-FIXES: s.starts_with("a");

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5505,6 +5505,31 @@ the configuration (without a prefix: ``Auto``).
55055505
}
55065506
}
55075507

5508+
.. _RemoveEmptyLinesInUnwrappedLines:
5509+
5510+
**RemoveEmptyLinesInUnwrappedLines** (``Boolean``) :versionbadge:`clang-format 20` :ref:`<RemoveEmptyLinesInUnwrappedLines>`
5511+
Remove empty lines within unwrapped lines.
5512+
5513+
.. code-block:: c++
5514+
5515+
false: true:
5516+
5517+
int c vs. int c = a + b;
5518+
5519+
= a + b;
5520+
5521+
enum : unsigned vs. enum : unsigned {
5522+
AA = 0,
5523+
{ BB
5524+
AA = 0, } myEnum;
5525+
BB
5526+
} myEnum;
5527+
5528+
while ( vs. while (true) {
5529+
}
5530+
true) {
5531+
}
5532+
55085533
.. _RemoveParentheses:
55095534

55105535
**RemoveParentheses** (``RemoveParenthesesStyle``) :versionbadge:`clang-format 17` :ref:`<RemoveParentheses>`

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,10 @@ clang-format
699699
- Adds ``BreakBinaryOperations`` option.
700700
- Adds ``TemplateNames`` option.
701701
- Adds ``AlignFunctionDeclarations`` option to ``AlignConsecutiveDeclarations``.
702-
- Adds ``IndentOnly`` suboption to ``ReflowComments`` to fix the indentation of multi-line comments
703-
without touching their contents, renames ``false`` to ``Never``, and ``true`` to ``Always``.
702+
- Adds ``IndentOnly`` suboption to ``ReflowComments`` to fix the indentation of
703+
multi-line comments without touching their contents, renames ``false`` to
704+
``Never``, and ``true`` to ``Always``.
705+
- Adds ``RemoveEmptyLinesInUnwrappedLines`` option.
704706

705707
libclang
706708
--------

clang/include/clang/AST/Type.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6320,6 +6320,10 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
63206320
static bool classof(const Type *T) {
63216321
return T->getTypeClass() == HLSLAttributedResource;
63226322
}
6323+
6324+
// Returns handle type from HLSL resource, if the type is a resource
6325+
static const HLSLAttributedResourceType *
6326+
findHandleTypeOnResource(const Type *RT);
63236327
};
63246328

63256329
class TemplateTypeParmType : public Type, public llvm::FoldingSetNode {

clang/include/clang/Driver/Options.td

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,7 +3454,8 @@ def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
34543454
def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>;
34553455
def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">, Group<f_Group>;
34563456
def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
3457-
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>;
3457+
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>,
3458+
Visibility<[ClangOption, FlangOption]>;
34583459
def fno_pointer_tbaa : Flag<["-"], "fno-pointer-tbaa">, Group<f_Group>;
34593460
def fno_temp_file : Flag<["-"], "fno-temp-file">, Group<f_Group>,
34603461
Visibility<[ClangOption, CC1Option, CLOption, DXCOption]>, HelpText<
@@ -3470,7 +3471,8 @@ def fno_verbose_asm : Flag<["-"], "fno-verbose-asm">, Group<f_Group>,
34703471
Visibility<[ClangOption, CC1Option]>,
34713472
MarshallingInfoNegativeFlag<CodeGenOpts<"AsmVerbose">>;
34723473
def fno_working_directory : Flag<["-"], "fno-working-directory">, Group<f_Group>;
3473-
def fno_wrapv : Flag<["-"], "fno-wrapv">, Group<f_Group>;
3474+
def fno_wrapv : Flag<["-"], "fno-wrapv">, Group<f_Group>,
3475+
Visibility<[ClangOption, FlangOption]>;
34743476
def fobjc_arc : Flag<["-"], "fobjc-arc">, Group<f_Group>,
34753477
Visibility<[ClangOption, CC1Option]>,
34763478
HelpText<"Synthesize retain and release calls for Objective-C pointers">;
@@ -3966,7 +3968,8 @@ defm strict_vtable_pointers : BoolFOption<"strict-vtable-pointers",
39663968
"Enable optimizations based on the strict rules for"
39673969
" overwriting polymorphic C++ objects">,
39683970
NegFlag<SetFalse>>;
3969-
def fstrict_overflow : Flag<["-"], "fstrict-overflow">, Group<f_Group>;
3971+
def fstrict_overflow : Flag<["-"], "fstrict-overflow">, Group<f_Group>,
3972+
Visibility<[ClangOption, FlangOption]>;
39703973
def fpointer_tbaa : Flag<["-"], "fpointer-tbaa">, Group<f_Group>;
39713974
def fdriver_only : Flag<["-"], "fdriver-only">, Flags<[NoXarchOption]>,
39723975
Visibility<[ClangOption, CLOption, DXCOption]>,
@@ -4235,7 +4238,7 @@ defm virtual_function_elimination : BoolFOption<"virtual-function-elimination",
42354238
NegFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption]>>;
42364239

42374240
def fwrapv : Flag<["-"], "fwrapv">, Group<f_Group>,
4238-
Visibility<[ClangOption, CC1Option]>,
4241+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
42394242
HelpText<"Treat signed integer overflow as two's complement">;
42404243
def fwritable_strings : Flag<["-"], "fwritable-strings">, Group<f_Group>,
42414244
Visibility<[ClangOption, CC1Option]>,
@@ -5387,6 +5390,10 @@ def mno_lasx : Flag<["-"], "mno-lasx">, Group<m_loongarch_Features_Group>,
53875390
let Flags = [TargetSpecific] in {
53885391
def msimd_EQ : Joined<["-"], "msimd=">, Group<m_loongarch_Features_Group>,
53895392
HelpText<"Select the SIMD extension(s) to be enabled in LoongArch either 'none', 'lsx', 'lasx'.">;
5393+
def mfrecipe : Flag<["-"], "mfrecipe">, Group<m_loongarch_Features_Group>,
5394+
HelpText<"Enable frecipe.{s/d} and frsqrte.{s/d}">;
5395+
def mno_frecipe : Flag<["-"], "mno-frecipe">, Group<m_loongarch_Features_Group>,
5396+
HelpText<"Disable frecipe.{s/d} and frsqrte.{s/d}">;
53905397
def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group<m_loongarch_Features_Group>,
53915398
HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">;
53925399
def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group<m_loongarch_Features_Group>,

clang/include/clang/Format/Format.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,6 +3938,29 @@ struct FormatStyle {
39383938
/// \version 14
39393939
bool RemoveBracesLLVM;
39403940

3941+
/// Remove empty lines within unwrapped lines.
3942+
/// \code
3943+
/// false: true:
3944+
///
3945+
/// int c vs. int c = a + b;
3946+
///
3947+
/// = a + b;
3948+
///
3949+
/// enum : unsigned vs. enum : unsigned {
3950+
/// AA = 0,
3951+
/// { BB
3952+
/// AA = 0, } myEnum;
3953+
/// BB
3954+
/// } myEnum;
3955+
///
3956+
/// while ( vs. while (true) {
3957+
/// }
3958+
/// true) {
3959+
/// }
3960+
/// \endcode
3961+
/// \version 20
3962+
bool RemoveEmptyLinesInUnwrappedLines;
3963+
39413964
/// Types of redundant parentheses to remove.
39423965
enum RemoveParenthesesStyle : int8_t {
39433966
/// Do not remove parentheses.
@@ -5232,6 +5255,8 @@ struct FormatStyle {
52325255
RawStringFormats == R.RawStringFormats &&
52335256
ReferenceAlignment == R.ReferenceAlignment &&
52345257
RemoveBracesLLVM == R.RemoveBracesLLVM &&
5258+
RemoveEmptyLinesInUnwrappedLines ==
5259+
R.RemoveEmptyLinesInUnwrappedLines &&
52355260
RemoveParentheses == R.RemoveParentheses &&
52365261
RemoveSemicolon == R.RemoveSemicolon &&
52375262
RequiresClausePosition == R.RequiresClausePosition &&

0 commit comments

Comments
 (0)