Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5554c6d

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-verify-def-use-phi
2 parents 60d5ec9 + 7500cea commit 5554c6d

File tree

24 files changed

+387
-204
lines changed

24 files changed

+387
-204
lines changed

bolt/lib/Rewrite/BuildIDRewriter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ Error BuildIDRewriter::sectionInitializer() {
7878
"out of bounds while reading note section: %s",
7979
toString(Cursor.takeError()).c_str());
8080

81-
if (Type == ELF::NT_GNU_BUILD_ID && Name.substr(0, 3) == "GNU" &&
82-
DescSz) {
81+
if (Type == ELF::NT_GNU_BUILD_ID && Name.starts_with("GNU") && DescSz) {
8382
BuildIDSection = NoteSection;
8483
BuildID = Desc;
8584
BC.setFileBuildID(getPrintableBuildID(Desc));

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ enum DriverMode : unsigned char {
404404
DriverMode getDriverMode(const std::vector<std::string> &Args) {
405405
DriverMode Mode = DM_GCC;
406406
llvm::StringRef Argv0 = Args.front();
407-
if (Argv0.ends_with_insensitive(".exe"))
408-
Argv0 = Argv0.drop_back(strlen(".exe"));
407+
Argv0.consume_back_insensitive(".exe");
409408
if (Argv0.ends_with_insensitive("cl"))
410409
Mode = DM_CL;
411410
for (const llvm::StringRef Arg : Args) {

clang/include/clang/Driver/Compilation.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,8 @@ class Compilation {
9090
: TC(TC), BoundArch(BoundArch), DeviceOffloadKind(DeviceOffloadKind) {}
9191

9292
bool operator<(const TCArgsKey &K) const {
93-
if (TC < K.TC)
94-
return true;
95-
else if (TC == K.TC && BoundArch < K.BoundArch)
96-
return true;
97-
else if (TC == K.TC && BoundArch == K.BoundArch &&
98-
DeviceOffloadKind < K.DeviceOffloadKind)
99-
return true;
100-
return false;
93+
return std::tie(TC, BoundArch, DeviceOffloadKind) <
94+
std::tie(K.TC, K.BoundArch, K.DeviceOffloadKind);
10195
}
10296
};
10397
std::map<TCArgsKey, llvm::opt::DerivedArgList *> TCArgs;

clang/lib/Driver/Job.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ rewriteIncludes(const llvm::ArrayRef<const char *> &Args, size_t Idx,
184184
StringRef FlagRef(Args[Idx + NumArgs - 1]);
185185
assert((FlagRef.starts_with("-F") || FlagRef.starts_with("-I")) &&
186186
"Expecting -I or -F");
187-
StringRef Inc = FlagRef.slice(2, StringRef::npos);
187+
StringRef Inc = FlagRef.substr(2);
188188
if (getAbsPath(Inc, NewInc)) {
189189
SmallString<128> NewArg(FlagRef.slice(0, 2));
190190
NewArg += NewInc;

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ std::string ToolChain::detectLibcxxVersion(StringRef IncludePath) const {
14411441
StringRef VersionText = llvm::sys::path::filename(LI->path());
14421442
int Version;
14431443
if (VersionText[0] == 'v' &&
1444-
!VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) {
1444+
!VersionText.substr(1).getAsInteger(10, Version)) {
14451445
if (Version > MaxVersion) {
14461446
MaxVersion = Version;
14471447
MaxVersionString = std::string(VersionText);

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ class DeserializedDeclsSourceRangePrinter : public ASTConsumer,
100100
unsigned Column;
101101

102102
bool operator<(const Position &other) const {
103-
if (Line < other.Line)
104-
return true;
105-
if (Line > other.Line)
106-
return false;
107-
return Column < other.Column;
103+
return std::tie(Line, Column) < std::tie(other.Line, other.Column);
108104
}
109105

110106
static Position GetBeginSpelling(const SourceManager &SM,

clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ class ZeroState {
4141
}
4242

4343
bool operator<(const ZeroState &X) const {
44-
if (BlockID != X.BlockID)
45-
return BlockID < X.BlockID;
46-
if (SFC != X.SFC)
47-
return SFC < X.SFC;
48-
return ZeroSymbol < X.ZeroSymbol;
44+
return std::tie(BlockID, SFC, ZeroSymbol) <
45+
std::tie(X.BlockID, X.SFC, X.ZeroSymbol);
4946
}
5047

5148
void Profile(llvm::FoldingSetNodeID &ID) const {

clang/utils/TableGen/ClangOptionDocEmitter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,7 @@ std::string escapeRST(StringRef Str) {
205205
}
206206

207207
StringRef getSphinxOptionID(StringRef OptionName) {
208-
for (auto I = OptionName.begin(), E = OptionName.end(); I != E; ++I)
209-
if (!isalnum(*I) && *I != '-')
210-
return OptionName.substr(0, I - OptionName.begin());
211-
return OptionName;
208+
return OptionName.take_while([](char C) { return isalnum(C) || C == '-'; });
212209
}
213210

214211
bool canSphinxCopeWithOption(const Record *Option) {

llvm/include/llvm/Support/InstructionCost.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "llvm/Support/MathExtras.h"
2222
#include <limits>
23+
#include <tuple>
2324

2425
namespace llvm {
2526

@@ -191,9 +192,7 @@ class InstructionCost {
191192
/// the states are valid and users can test for validity of the cost
192193
/// explicitly.
193194
bool operator<(const InstructionCost &RHS) const {
194-
if (State != RHS.State)
195-
return State < RHS.State;
196-
return Value < RHS.Value;
195+
return std::tie(State, Value) < std::tie(RHS.State, RHS.Value);
197196
}
198197

199198
bool operator==(const InstructionCost &RHS) const {

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,9 +2659,9 @@ void ModuleBitcodeWriter::writeFunctionMetadataAttachment(const Function &F) {
26592659

26602660
Record.push_back(VE.getInstructionID(&I));
26612661

2662-
for (unsigned i = 0, e = MDs.size(); i != e; ++i) {
2663-
Record.push_back(MDs[i].first);
2664-
Record.push_back(VE.getMetadataID(MDs[i].second));
2662+
for (const auto &[ID, MD] : MDs) {
2663+
Record.push_back(ID);
2664+
Record.push_back(VE.getMetadataID(MD));
26652665
}
26662666
Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);
26672667
Record.clear();

0 commit comments

Comments
 (0)