mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-14 17:06:38 +00:00
[clang-tools-extra] Use *Set::insert_range (NFC) (#132589)
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently gained C++23-style insert_range. This patch replaces: Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src);
This commit is contained in:
parent
c440563da7
commit
4a7643400c
@ -464,7 +464,7 @@ getUsedDecls(const HelperDeclRefGraph *RG,
|
||||
for (const auto *D : Decls) {
|
||||
auto Result = RG->getReachableNodes(
|
||||
HelperDeclRGBuilder::getOutmostClassOrFunDecl(D));
|
||||
Nodes.insert(Result.begin(), Result.end());
|
||||
Nodes.insert_range(Result);
|
||||
}
|
||||
llvm::DenseSet<const Decl *> Results;
|
||||
for (const auto *Node : Nodes)
|
||||
|
@ -43,13 +43,11 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
|
||||
IgnoredExceptionsVec;
|
||||
StringRef(RawFunctionsThatShouldNotThrow)
|
||||
.split(FunctionsThatShouldNotThrowVec, ",", -1, false);
|
||||
FunctionsThatShouldNotThrow.insert(FunctionsThatShouldNotThrowVec.begin(),
|
||||
FunctionsThatShouldNotThrowVec.end());
|
||||
FunctionsThatShouldNotThrow.insert_range(FunctionsThatShouldNotThrowVec);
|
||||
|
||||
llvm::StringSet<> IgnoredExceptions;
|
||||
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
|
||||
IgnoredExceptions.insert(IgnoredExceptionsVec.begin(),
|
||||
IgnoredExceptionsVec.end());
|
||||
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
|
||||
Tracer.ignoreExceptions(std::move(IgnoredExceptions));
|
||||
Tracer.ignoreBadAlloc(true);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
// We've decided that it isn't performant to keep using vector.
|
||||
// Let's migrate the data into Set.
|
||||
Set.reserve(Storage.size());
|
||||
Set.insert(Storage.begin(), Storage.end());
|
||||
Set.insert_range(Storage);
|
||||
}
|
||||
|
||||
/// count - Return 1 if the element is in the set, 0 otherwise.
|
||||
@ -97,7 +97,7 @@ private:
|
||||
const size_t NewMaxElts = 4 * Vector.size();
|
||||
Vector.reserve(NewMaxElts);
|
||||
Set.reserve(NewMaxElts);
|
||||
Set.insert(Vector.begin(), Vector.end());
|
||||
Set.insert_range(Vector);
|
||||
}
|
||||
|
||||
/// count - Return 1 if the element is in the set, 0 otherwise.
|
||||
|
@ -30,8 +30,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
|
||||
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
|
||||
llvm::transform(IgnoredExceptionsVec, IgnoredExceptionsVec.begin(),
|
||||
[](StringRef S) { return S.trim(); });
|
||||
IgnoredExceptions.insert(IgnoredExceptionsVec.begin(),
|
||||
IgnoredExceptionsVec.end());
|
||||
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
|
||||
Tracer.ignoreExceptions(std::move(IgnoredExceptions));
|
||||
Tracer.ignoreBadAlloc(true);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ void ExceptionAnalyzer::ExceptionInfo::registerExceptions(
|
||||
if (Exceptions.empty())
|
||||
return;
|
||||
Behaviour = State::Throwing;
|
||||
ThrownExceptions.insert(Exceptions.begin(), Exceptions.end());
|
||||
ThrownExceptions.insert_range(Exceptions);
|
||||
}
|
||||
|
||||
ExceptionAnalyzer::ExceptionInfo &ExceptionAnalyzer::ExceptionInfo::merge(
|
||||
@ -39,8 +39,7 @@ ExceptionAnalyzer::ExceptionInfo &ExceptionAnalyzer::ExceptionInfo::merge(
|
||||
Behaviour = State::Unknown;
|
||||
|
||||
ContainsUnknown = ContainsUnknown || Other.ContainsUnknown;
|
||||
ThrownExceptions.insert(Other.ThrownExceptions.begin(),
|
||||
Other.ThrownExceptions.end());
|
||||
ThrownExceptions.insert_range(Other.ThrownExceptions);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ class Lookup : public Command {
|
||||
}
|
||||
|
||||
LookupRequest Request;
|
||||
Request.IDs.insert(IDs.begin(), IDs.end());
|
||||
Request.IDs.insert_range(IDs);
|
||||
bool FoundSymbol = false;
|
||||
Index->lookup(Request, [&](const Symbol &Sym) {
|
||||
FoundSymbol = true;
|
||||
@ -255,7 +255,7 @@ class Refs : public Command {
|
||||
}
|
||||
}
|
||||
RefsRequest RefRequest;
|
||||
RefRequest.IDs.insert(IDs.begin(), IDs.end());
|
||||
RefRequest.IDs.insert_range(IDs);
|
||||
llvm::Regex RegexFilter(Filter);
|
||||
Index->refs(RefRequest, [&RegexFilter](const Ref &R) {
|
||||
auto U = URI::parse(R.Location.FileURI);
|
||||
|
@ -151,7 +151,7 @@ std::vector<std::string> match(const SymbolIndex &I,
|
||||
std::vector<std::string> lookup(const SymbolIndex &I,
|
||||
llvm::ArrayRef<SymbolID> IDs) {
|
||||
LookupRequest Req;
|
||||
Req.IDs.insert(IDs.begin(), IDs.end());
|
||||
Req.IDs.insert_range(IDs);
|
||||
std::vector<std::string> Results;
|
||||
I.lookup(Req, [&](const Symbol &Sym) {
|
||||
Results.push_back(getQualifiedName(Sym));
|
||||
|
Loading…
x
Reference in New Issue
Block a user