Skip to content

Commit 0cbf989

Browse files
committed
Merge from 'main' to 'sycl-web' (15 commits)
CONFLICT (content): Merge conflict in clang/lib/Basic/Attributes.cpp CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaDeclAttr.cpp
2 parents 5e908a0 + f3dcc23 commit 0cbf989

File tree

273 files changed

+6959
-756
lines changed

Some content is hidden

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

273 files changed

+6959
-756
lines changed

bolt/test/X86/dwarf-test-df-logging.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; RUN: -split-dwarf-file=main.dwo -o main.o
77
; RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-df-dualcu-helper.s \
88
; RUN: -split-dwarf-file=helper.dwo -o helper.o
9-
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
9+
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie
1010
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections | FileCheck -check-prefix=BOLT %s
1111

1212
; BOLT: BOLT-INFO: processing split DWARF

bolt/test/X86/dwarf4-df-dualcu.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; RUN: -split-dwarf-file=main.dwo -o main.o
66
; RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-df-dualcu-helper.s \
77
; RUN: -split-dwarf-file=helper.dwo -o helper.o
8-
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
8+
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie
99
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges
1010
; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s
1111
; RUN: llvm-dwarfdump --show-form --verbose --debug-ranges main.exe.bolt &> %t/foo.txt

bolt/test/X86/dwarf4-split-dwarf-no-address.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; RUN: --filetype=obj %p/Inputs/dwarf4-split-dwarf-no-address-main.s -o=main.o
66
; RUN: llvm-mc --split-dwarf-file=helper.dwo --triple=x86_64-unknown-linux-gnu \
77
; RUN: --filetype=obj %p/Inputs/dwarf4-split-dwarf-no-address-helper.s -o=helper.o
8-
; RUN: %clang %cflags -gdwarf-4 -gsplit-dwarf=split main.o helper.o -o main.exe
8+
; RUN: %clang %cflags -gdwarf-4 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie
99
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections
1010
; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe.bolt | FileCheck -check-prefix=BOLT %s
1111

bolt/test/X86/dwarf5-df-dualcu.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; RUN: -split-dwarf-file=main.dwo -o main.o
66
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-dualcu-helper.s \
77
; RUN: -split-dwarf-file=helper.dwo -o helper.o
8-
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
8+
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie
99
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges
1010
; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s
1111
; RUN: llvm-dwarfdump --show-form --verbose --debug-addr main.exe.bolt &> %t/foo.txt

bolt/test/X86/dwarf5-df-mono-dualcu.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-mono-main.s \
55
; RUN: -split-dwarf-file=main.dwo -o main.o
66
; RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux-gnu %p/Inputs/dwarf5-df-mono-helper.s -o=helper.o
7-
; RUN: %clang %cflags -gdwarf-5 main.o helper.o -o main.exe
7+
; RUN: %clang %cflags -gdwarf-5 main.o helper.o -o main.exe -fno-pic -no-pie
88
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges
99
; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s
1010
; RUN: llvm-dwarfdump --show-form --verbose --debug-addr main.exe.bolt &> %t/foo.txt

bolt/test/X86/dwarf5-locaddrx.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
; RUN: cd %t
44
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-locaddrx.s \
55
; RUN: -split-dwarf-file=mainlocadddrx.dwo -o mainlocadddrx.o
6-
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split mainlocadddrx.o -o mainlocadddrx.exe
6+
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split mainlocadddrx.o -o mainlocadddrx.exe -fno-pic -no-pie
77
; RUN: llvm-bolt mainlocadddrx.exe -o mainlocadddrx.exe.bolt --update-debug-sections --always-convert-to-ranges
88
; RUN: llvm-dwarfdump --show-form --verbose --debug-info mainlocadddrx.exe | FileCheck -check-prefix=PRE-BOLT %s
99
; RUN: llvm-dwarfdump --show-form --verbose --debug-addr mainlocadddrx.exe.bolt &> %t/foo.txt

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ set(LLVM_TOOLCHAIN_TOOLS
336336
llvm-symbolizer
337337
llvm-undname
338338
llvm-xray
339+
opt-viewer
339340
sancov
340341
scan-build-py
341342
CACHE STRING "")

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,7 +3943,7 @@ def Target : InheritableAttr {
39433943

39443944
for (auto &Feature : AttrFeatures) {
39453945
Feature = Feature.trim();
3946-
if (Feature.startswith("arch="))
3946+
if (Feature.starts_with("arch="))
39473947
return Feature.drop_front(sizeof("arch=") - 1);
39483948
}
39493949
return "";
@@ -3961,8 +3961,8 @@ def Target : InheritableAttr {
39613961
for (auto &Feature : AttrFeatures) {
39623962
Feature = Feature.trim();
39633963

3964-
if (!Feature.startswith("no-") && !Feature.startswith("arch=") &&
3965-
!Feature.startswith("fpmath=") && !Feature.startswith("tune="))
3964+
if (!Feature.starts_with("no-") && !Feature.starts_with("arch=") &&
3965+
!Feature.starts_with("fpmath=") && !Feature.starts_with("tune="))
39663966
Out.push_back(Feature);
39673967
}
39683968
}

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
511511
/// function(<#int x#>);
512512
/// \endcode
513513
bool isEditorPlaceholder() const {
514-
return getName().startswith("<#") && getName().endswith("#>");
514+
return getName().starts_with("<#") && getName().ends_with("#>");
515515
}
516516

517517
/// Determine whether \p this is a name reserved for the implementation (C99

clang/include/clang/Basic/TargetBuiltins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ namespace clang {
309309
bool isTupleSet() const { return Flags & IsTupleSet; }
310310
bool isReadZA() const { return Flags & IsReadZA; }
311311
bool isWriteZA() const { return Flags & IsWriteZA; }
312-
312+
bool isReductionQV() const { return Flags & IsReductionQV; }
313313
uint64_t getBits() const { return Flags; }
314314
bool isFlagSet(uint64_t Flag) const { return Flags & Flag; }
315315
};

clang/include/clang/Basic/arm_sve.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,23 @@ def SVPSEL_COUNT_ALIAS_S : SInst<"svpsel_lane_c32", "}}Pm", "Pi", MergeNone, "",
19461946
def SVPSEL_COUNT_ALIAS_D : SInst<"svpsel_lane_c64", "}}Pm", "Pl", MergeNone, "", [IsStreamingCompatible], []>;
19471947
}
19481948

1949+
// Standalone sve2.1 builtins
1950+
let TargetGuard = "sve2p1" in {
1951+
def SVORQV : SInst<"svorqv[_{d}]", "{Pd", "csilUcUsUiUl", MergeNone, "aarch64_sve_orqv", [IsReductionQV]>;
1952+
def SVEORQV : SInst<"sveorqv[_{d}]", "{Pd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorqv", [IsReductionQV]>;
1953+
def SVADDQV : SInst<"svaddqv[_{d}]", "{Pd", "hfdcsilUcUsUiUl", MergeNone, "aarch64_sve_addqv", [IsReductionQV]>;
1954+
def SVANDQV : SInst<"svandqv[_{d}]", "{Pd", "csilUcUsUiUl", MergeNone, "aarch64_sve_andqv", [IsReductionQV]>;
1955+
def SVSMAXQV : SInst<"svmaxqv[_{d}]", "{Pd", "csil", MergeNone, "aarch64_sve_smaxqv", [IsReductionQV]>;
1956+
def SVUMAXQV : SInst<"svmaxqv[_{d}]", "{Pd", "UcUsUiUl", MergeNone, "aarch64_sve_umaxqv", [IsReductionQV]>;
1957+
def SVSMINQV : SInst<"svminqv[_{d}]", "{Pd", "csil", MergeNone, "aarch64_sve_sminqv", [IsReductionQV]>;
1958+
def SVUMINQV : SInst<"svminqv[_{d}]", "{Pd", "UcUsUiUl", MergeNone, "aarch64_sve_uminqv", [IsReductionQV]>;
1959+
1960+
def SVFMAXNMQV: SInst<"svmaxnmqv[_{d}]", "{Pd", "hfd", MergeNone, "aarch64_sve_fmaxnmqv", [IsReductionQV]>;
1961+
def SVFMINNMQV: SInst<"svminnmqv[_{d}]", "{Pd", "hfd", MergeNone, "aarch64_sve_fminnmqv", [IsReductionQV]>;
1962+
def SVFMAXQV: SInst<"svmaxqv[_{d}]", "{Pd", "hfd", MergeNone, "aarch64_sve_fmaxqv", [IsReductionQV]>;
1963+
def SVFMINQV: SInst<"svminqv[_{d}]", "{Pd", "hfd", MergeNone, "aarch64_sve_fminqv", [IsReductionQV]>;
1964+
}
1965+
19491966
let TargetGuard = "sve2p1|sme2" in {
19501967
//FIXME: Replace IsStreamingCompatible with IsStreamingOrHasSVE2p1 when available
19511968
def SVPEXT_SINGLE : SInst<"svpext_lane_{d}", "P}i", "QcQsQiQl", MergeNone, "aarch64_sve_pext", [IsStreamingCompatible], [ImmCheck<1, ImmCheck0_3>]>;

clang/include/clang/Basic/arm_sve_sme_incl.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
// Z: const pointer to uint64_t
130130

131131
// Prototype modifiers added for SVE2p1
132+
// {: 128b vector
132133
// }: svcount_t
133134

134135
class MergeType<int val, string suffix=""> {
@@ -225,6 +226,7 @@ def IsSharedZA : FlagType<0x8000000000>;
225226
def IsPreservesZA : FlagType<0x10000000000>;
226227
def IsReadZA : FlagType<0x20000000000>;
227228
def IsWriteZA : FlagType<0x40000000000>;
229+
def IsReductionQV : FlagType<0x80000000000>;
228230

229231
// These must be kept in sync with the flags in include/clang/Basic/TargetBuiltins.h
230232
class ImmCheckType<int val> {

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,9 +2975,11 @@ defm asm_blocks : BoolFOption<"asm-blocks",
29752975
LangOpts<"AsmBlocks">, Default<fms_extensions.KeyPath>,
29762976
PosFlag<SetTrue, [], [ClangOption, CC1Option]>,
29772977
NegFlag<SetFalse>>;
2978-
def fms_volatile : Flag<["-"], "fms-volatile">, Group<f_Group>,
2979-
Visibility<[ClangOption, CC1Option]>,
2980-
MarshallingInfoFlag<LangOpts<"MSVolatile">>;
2978+
defm ms_volatile : BoolFOption<"ms-volatile",
2979+
LangOpts<"MSVolatile">, DefaultFalse,
2980+
PosFlag<SetTrue, [], [ClangOption, CC1Option],
2981+
"Volatile loads and stores have acquire and release semantics">,
2982+
NegFlag<SetFalse>>;
29812983
def fmsc_version : Joined<["-"], "fmsc-version=">, Group<f_Group>,
29822984
Visibility<[ClangOption, CLOption]>,
29832985
HelpText<"Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))">;
@@ -8604,7 +8606,7 @@ def _SLASH_winsysroot : CLJoinedOrSeparate<"winsysroot">,
86048606
HelpText<"Same as \"/diasdkdir <dir>/DIA SDK\" /vctoolsdir <dir>/VC/Tools/MSVC/<vctoolsversion> \"/winsdkdir <dir>/Windows Kits/10\"">,
86058607
MetaVarName<"<dir>">;
86068608
def _SLASH_volatile_iso : Option<["/", "-"], "volatile:iso", KIND_FLAG>,
8607-
Group<_SLASH_volatile_Group>, Flags<[NoXarchOption]>, Visibility<[CLOption]>,
8609+
Visibility<[CLOption]>, Alias<fno_ms_volatile>,
86088610
HelpText<"Volatile loads and stores have standard semantics">;
86098611
def _SLASH_vmb : CLFlag<"vmb">,
86108612
HelpText<"Use a best-case representation method for member pointers">;
@@ -8619,7 +8621,7 @@ def _SLASH_vmv : CLFlag<"vmv">,
86198621
HelpText<"Set the default most-general representation to "
86208622
"virtual inheritance">;
86218623
def _SLASH_volatile_ms : Option<["/", "-"], "volatile:ms", KIND_FLAG>,
8622-
Group<_SLASH_volatile_Group>, Flags<[NoXarchOption]>, Visibility<[CLOption]>,
8624+
Visibility<[CLOption]>, Alias<fms_volatile>,
86238625
HelpText<"Volatile loads and stores have acquire and release semantics">;
86248626
def _SLASH_clang : CLJoined<"clang:">,
86258627
HelpText<"Pass <arg> to the clang driver">, MetaVarName<"<arg>">;

clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental) {
409409
};
410410
std::vector<StringRef> Checkers;
411411
for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
412-
if (!CheckerName.startswith("debug.") &&
413-
(IncludeExperimental || !CheckerName.startswith("alpha.")))
412+
if (!CheckerName.starts_with("debug.") &&
413+
(IncludeExperimental || !CheckerName.starts_with("alpha.")))
414414
Checkers.push_back(CheckerName);
415415
}
416416
return Checkers;

clang/lib/APINotes/APINotesManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static void checkPrivateAPINotesName(DiagnosticsEngine &Diags,
198198
StringRef RealFileName =
199199
llvm::sys::path::filename(File->tryGetRealPathName());
200200
StringRef RealStem = llvm::sys::path::stem(RealFileName);
201-
if (RealStem.endswith("_private"))
201+
if (RealStem.ends_with("_private"))
202202
return;
203203

204204
unsigned DiagID = diag::warn_apinotes_private_case;

clang/lib/APINotes/APINotesYAMLCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ class YAMLConverter {
745745
convertCommonEntity(M, MI, M.Selector);
746746

747747
// Check if the selector ends with ':' to determine if it takes arguments.
748-
bool takesArguments = M.Selector.endswith(":");
748+
bool takesArguments = M.Selector.ends_with(":");
749749

750750
// Split the selector into pieces.
751751
llvm::SmallVector<StringRef, 4> Args;

clang/lib/ARCMigrate/ARCMT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ createInvocationForMigration(CompilerInvocation &origCI,
201201
for (std::vector<std::string>::iterator
202202
I = CInvok->getDiagnosticOpts().Warnings.begin(),
203203
E = CInvok->getDiagnosticOpts().Warnings.end(); I != E; ++I) {
204-
if (!StringRef(*I).startswith("error"))
204+
if (!StringRef(*I).starts_with("error"))
205205
WarnOpts.push_back(*I);
206206
}
207207
WarnOpts.push_back("error=arc-unsafe-retained-assign");

clang/lib/ARCMigrate/ObjCMT.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter,
562562
static bool IsCategoryNameWithDeprecatedSuffix(ObjCContainerDecl *D) {
563563
if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(D)) {
564564
StringRef Name = CatDecl->getName();
565-
return Name.endswith("Deprecated");
565+
return Name.ends_with("Deprecated");
566566
}
567567
return false;
568568
}
@@ -1176,12 +1176,12 @@ bool ObjCMigrateASTConsumer::migrateProperty(ASTContext &Ctx,
11761176
if (!SetterMethod) {
11771177
// try a different naming convention for getter: isXxxxx
11781178
StringRef getterNameString = getterName->getName();
1179-
bool IsPrefix = getterNameString.startswith("is");
1179+
bool IsPrefix = getterNameString.starts_with("is");
11801180
// Note that we don't want to change an isXXX method of retainable object
11811181
// type to property (readonly or otherwise).
11821182
if (IsPrefix && GRT->isObjCRetainableType())
11831183
return false;
1184-
if (IsPrefix || getterNameString.startswith("get")) {
1184+
if (IsPrefix || getterNameString.starts_with("get")) {
11851185
LengthOfPrefix = (IsPrefix ? 2 : 3);
11861186
const char *CGetterName = getterNameString.data() + LengthOfPrefix;
11871187
// Make sure that first character after "is" or "get" prefix can
@@ -1320,11 +1320,11 @@ void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx,
13201320
if (OIT_Family == OIT_Singleton || OIT_Family == OIT_ReturnsSelf) {
13211321
StringRef STRefMethodName(MethodName);
13221322
size_t len = 0;
1323-
if (STRefMethodName.startswith("standard"))
1323+
if (STRefMethodName.starts_with("standard"))
13241324
len = strlen("standard");
1325-
else if (STRefMethodName.startswith("shared"))
1325+
else if (STRefMethodName.starts_with("shared"))
13261326
len = strlen("shared");
1327-
else if (STRefMethodName.startswith("default"))
1327+
else if (STRefMethodName.starts_with("default"))
13281328
len = strlen("default");
13291329
else
13301330
return;
@@ -1341,7 +1341,7 @@ void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx,
13411341
StringRef LoweredMethodName(MethodName);
13421342
std::string StringLoweredMethodName = LoweredMethodName.lower();
13431343
LoweredMethodName = StringLoweredMethodName;
1344-
if (!LoweredMethodName.startswith(ClassNamePostfix))
1344+
if (!LoweredMethodName.starts_with(ClassNamePostfix))
13451345
return;
13461346
if (OIT_Family == OIT_ReturnsSelf)
13471347
ReplaceWithClasstype(*this, OM);

clang/lib/ARCMigrate/TransUnbridgedCasts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
146146
ento::cocoa::isRefType(E->getSubExpr()->getType(), "CF",
147147
FD->getIdentifier()->getName())) {
148148
StringRef fname = FD->getIdentifier()->getName();
149-
if (fname.endswith("Retain") || fname.contains("Create") ||
149+
if (fname.ends_with("Retain") || fname.contains("Create") ||
150150
fname.contains("Copy")) {
151151
// Do not migrate to couple of bridge transfer casts which
152152
// cancel each other out. Leave it unchanged so error gets user

clang/lib/ARCMigrate/TransformActions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ bool TransformActionsImpl::canReplaceText(SourceLocation loc, StringRef text) {
431431
if (invalidTemp)
432432
return false;
433433

434-
return file.substr(locInfo.second).startswith(text);
434+
return file.substr(locInfo.second).starts_with(text);
435435
}
436436

437437
void TransformActionsImpl::commitInsert(SourceLocation loc, StringRef text) {

clang/lib/ARCMigrate/Transforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ bool trans::isPlusOne(const Expr *E) {
9595
ento::cocoa::isRefType(callE->getType(), "CF",
9696
FD->getIdentifier()->getName())) {
9797
StringRef fname = FD->getIdentifier()->getName();
98-
if (fname.endswith("Retain") || fname.contains("Create") ||
98+
if (fname.ends_with("Retain") || fname.contains("Create") ||
9999
fname.contains("Copy"))
100100
return true;
101101
}

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8246,7 +8246,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string &S,
82468246
// Another legacy compatibility encoding. Some ObjC qualifier and type
82478247
// combinations need to be rearranged.
82488248
// Rewrite "in const" from "nr" to "rn"
8249-
if (StringRef(S).endswith("nr"))
8249+
if (StringRef(S).ends_with("nr"))
82508250
S.replace(S.end()-2, S.end(), "rn");
82518251
}
82528252

@@ -13560,7 +13560,7 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
1356013560
Target->getTargetOpts().FeaturesAsWritten.begin(),
1356113561
Target->getTargetOpts().FeaturesAsWritten.end());
1356213562
} else {
13563-
if (VersionStr.startswith("arch="))
13563+
if (VersionStr.starts_with("arch="))
1356413564
TargetCPU = VersionStr.drop_front(sizeof("arch=") - 1);
1356513565
else if (VersionStr != "default")
1356613566
Features.push_back((StringRef{"+"} + VersionStr).str());

clang/lib/AST/DeclPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
17341734
std::string TypeStr = PDecl->getASTContext().getUnqualifiedObjCPointerType(T).
17351735
getAsString(Policy);
17361736
Out << ' ' << TypeStr;
1737-
if (!StringRef(TypeStr).endswith("*"))
1737+
if (!StringRef(TypeStr).ends_with("*"))
17381738
Out << ' ';
17391739
Out << *PDecl;
17401740
if (Policy.PolishForDeclaration)

clang/lib/AST/Mangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void MangleContext::mangleName(GlobalDecl GD, raw_ostream &Out) {
147147

148148
// If the label isn't literal, or if this is an alias for an LLVM intrinsic,
149149
// do not add a "\01" prefix.
150-
if (!ALA->getIsLiteralLabel() || ALA->getLabel().startswith("llvm.")) {
150+
if (!ALA->getIsLiteralLabel() || ALA->getLabel().starts_with("llvm.")) {
151151
Out << ALA->getLabel();
152152
return;
153153
}

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct msvc_hashing_ostream : public llvm::raw_svector_ostream {
6363
: llvm::raw_svector_ostream(Buffer), OS(OS) {}
6464
~msvc_hashing_ostream() override {
6565
StringRef MangledName = str();
66-
bool StartsWithEscape = MangledName.startswith("\01");
66+
bool StartsWithEscape = MangledName.starts_with("\01");
6767
if (StartsWithEscape)
6868
MangledName = MangledName.drop_front(1);
6969
if (MangledName.size() < 4096) {

clang/lib/AST/PrintfFormatString.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H,
140140
// Set the privacy flag if the privacy annotation in the
141141
// comma-delimited segment is at least as strict as the privacy
142142
// annotations in previous comma-delimited segments.
143-
if (MatchedStr.startswith("mask")) {
143+
if (MatchedStr.starts_with("mask")) {
144144
StringRef MaskType = MatchedStr.substr(sizeof("mask.") - 1);
145145
unsigned Size = MaskType.size();
146146
if (Warn && (Size == 0 || Size > 8))

clang/lib/AST/RawCommentList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ RawComment::RawComment(const SourceManager &SourceMgr, SourceRange SR,
141141
Kind = K.first;
142142
IsTrailingComment |= K.second;
143143

144-
IsAlmostTrailingComment = RawText.startswith("//<") ||
145-
RawText.startswith("/*<");
144+
IsAlmostTrailingComment =
145+
RawText.starts_with("//<") || RawText.starts_with("/*<");
146146
} else {
147147
Kind = RCK_Merged;
148148
IsTrailingComment =

clang/lib/AST/Stmt.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,11 +811,12 @@ std::string MSAsmStmt::generateAsmString(const ASTContext &C) const {
811811
StringRef Instruction = Pieces[I];
812812
// For vex/vex2/vex3/evex masm style prefix, convert it to att style
813813
// since we don't support masm style prefix in backend.
814-
if (Instruction.startswith("vex "))
814+
if (Instruction.starts_with("vex "))
815815
MSAsmString += '{' + Instruction.substr(0, 3).str() + '}' +
816816
Instruction.substr(3).str();
817-
else if (Instruction.startswith("vex2 ") ||
818-
Instruction.startswith("vex3 ") || Instruction.startswith("evex "))
817+
else if (Instruction.starts_with("vex2 ") ||
818+
Instruction.starts_with("vex3 ") ||
819+
Instruction.starts_with("evex "))
819820
MSAsmString += '{' + Instruction.substr(0, 4).str() + '}' +
820821
Instruction.substr(4).str();
821822
else

0 commit comments

Comments
 (0)