junaire created this revision. junaire added reviewers: zaks.anna, dcoughlin. Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. junaire requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Use range base loop loop to improve code readability. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D119103 Files: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Index: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -383,14 +383,14 @@ } 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 @@ 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.
Index: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -383,14 +383,14 @@ } 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 @@ 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