[clang] Use llvm::reverse (NFC)

This commit is contained in:
Kazu Hirata 2021-12-17 16:51:42 -08:00
parent ac313c37e1
commit 713ee230f8
5 changed files with 6 additions and 9 deletions

View File

@ -4133,8 +4133,7 @@ void CodeGenFunction::EmitCallArgs(
}
// If we still have any arguments, emit them using the type of the argument.
for (auto *A : llvm::make_range(std::next(ArgRange.begin(), ArgTypes.size()),
ArgRange.end()))
for (auto *A : llvm::drop_begin(ArgRange, ArgTypes.size()))
ArgTypes.push_back(IsVariadic ? getVarArgType(A) : A->getType());
assert((int)ArgTypes.size() == (ArgRange.end() - ArgRange.begin()));

View File

@ -472,11 +472,9 @@ void TokenLexer::ExpandFunctionArguments() {
// If the '##' came from expanding an argument, turn it into 'unknown'
// to avoid pasting.
for (Token &Tok : llvm::make_range(ResultToks.begin() + FirstResult,
ResultToks.end())) {
for (Token &Tok : llvm::drop_begin(ResultToks, FirstResult))
if (Tok.is(tok::hashhash))
Tok.setKind(tok::unknown);
}
if(ExpandLocStart.isValid()) {
updateLocForMacroArgTokens(CurTok.getLocation(),

View File

@ -18285,7 +18285,7 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
// Emit one note for each of the remaining enum constants with
// the same value.
for (auto *ECD : llvm::make_range(Vec->begin() + 1, Vec->end()))
for (auto *ECD : llvm::drop_begin(*Vec))
S.Diag(ECD->getLocation(), diag::note_duplicate_element)
<< ECD << toString(ECD->getInitVal(), 10)
<< ECD->getSourceRange();

View File

@ -10004,7 +10004,7 @@ StmtResult Sema::ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
return StmtError();
// All associated statements must be '#pragma omp section' except for
// the first one.
for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) {
for (Stmt *SectionStmt : llvm::drop_begin(S)) {
if (!SectionStmt || !isa<OMPSectionDirective>(SectionStmt)) {
if (SectionStmt)
Diag(SectionStmt->getBeginLoc(),
@ -10386,7 +10386,7 @@ Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
return StmtError();
// All associated statements must be '#pragma omp section' except for
// the first one.
for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) {
for (Stmt *SectionStmt : llvm::drop_begin(S)) {
if (!SectionStmt || !isa<OMPSectionDirective>(SectionStmt)) {
if (SectionStmt)
Diag(SectionStmt->getBeginLoc(),

View File

@ -410,7 +410,7 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,
}
// Append files to the main report file in the order they appear in the path
for (auto I : llvm::make_range(FileIDs.begin() + 1, FileIDs.end())) {
for (auto I : llvm::drop_begin(FileIDs)) {
std::string s;
llvm::raw_string_ostream os(s);