Author: Kazu Hirata Date: 2021-12-17T16:51:42-08:00 New Revision: 713ee230f884651afd17ab7b910e85a992ce406b
URL: https://github.com/llvm/llvm-project/commit/713ee230f884651afd17ab7b910e85a992ce406b DIFF: https://github.com/llvm/llvm-project/commit/713ee230f884651afd17ab7b910e85a992ce406b.diff LOG: [clang] Use llvm::reverse (NFC) Added: Modified: clang/lib/CodeGen/CGCall.cpp clang/lib/Lex/TokenLexer.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index be20f7cc41e86..e4526ff30bdd8 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -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())); diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 41e7f3f1dccb8..e71a65f031e43 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -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(), diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 5e9c92db81b4a..2af71661b7826 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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(); diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index c873e2661d44b..4afbf62580085 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -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(), diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 8ed378cbf9a52..b4578385a1479 100644 --- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits