Author: Jun Zhang Date: 2022-02-07T15:45:58+08:00 New Revision: 65adf7c2117ab2b2ff72a8c761164fb2c1b686c0
URL: https://github.com/llvm/llvm-project/commit/65adf7c2117ab2b2ff72a8c761164fb2c1b686c0 DIFF: https://github.com/llvm/llvm-project/commit/65adf7c2117ab2b2ff72a8c761164fb2c1b686c0.diff LOG: [NFC][Analyzer] Use range based for loop. Use range base loop loop to improve code readability. Differential Revision: https://reviews.llvm.org/D119103 Added: Modified: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Removed: ################################################################################ diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index b152f9d80ef5b..323c002d0cef6 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -383,14 +383,14 @@ void AnalysisConsumer::HandleTopLevelDeclInObjCContainer(DeclGroupRef DG) { } void AnalysisConsumer::storeTopLevelDecls(DeclGroupRef DG) { - for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I) { + for (auto &I : DG) { // Skip ObjCMethodDecl, wait for the objc container to avoid // analyzing twice. - if (isa<ObjCMethodDecl>(*I)) + if (isa<ObjCMethodDecl>(I)) continue; - LocalTUDecls.push_back(*I); + LocalTUDecls.push_back(I); } } @@ -462,11 +462,9 @@ void AnalysisConsumer::HandleDeclsCallGraph(const unsigned LocalTUDeclsSize) { SetOfConstDecls Visited; SetOfConstDecls VisitedAsTopLevel; llvm::ReversePostOrderTraversal<clang::CallGraph*> RPOT(&CG); - for (llvm::ReversePostOrderTraversal<clang::CallGraph*>::rpo_iterator - I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { + for (auto &N : RPOT) { NumFunctionTopLevel++; - CallGraphNode *N = *I; Decl *D = N->getDecl(); // Skip the abstract root node. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits