[clang] bfd58fc - clang/Modules: Use range-based for in ASTReader::ReadAST, NFC

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 15:54:05 PST 2019


Author: Duncan P. N. Exon Smith
Date: 2019-11-11T15:53:48-08:00
New Revision: bfd58fc60ff4b0c081b5b489119c3798d3e2b53c

URL: https://github.com/llvm/llvm-project/commit/bfd58fc60ff4b0c081b5b489119c3798d3e2b53c
DIFF: https://github.com/llvm/llvm-project/commit/bfd58fc60ff4b0c081b5b489119c3798d3e2b53c.diff

LOG: clang/Modules: Use range-based for in ASTReader::ReadAST, NFC

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReader.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index cc1f01210885..412bc78c1afa 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4203,10 +4203,8 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName,
   // Here comes stuff that we only do once the entire chain is loaded.
 
   // Load the AST blocks of all of the modules that we loaded.
-  for (SmallVectorImpl<ImportedModule>::iterator M = Loaded.begin(),
-                                              MEnd = Loaded.end();
-       M != MEnd; ++M) {
-    ModuleFile &F = *M->Mod;
+  for (ImportedModule &M : Loaded) {
+    ModuleFile &F = *M.Mod;
 
     // Read the AST block.
     if (ASTReadResult Result = ReadASTBlock(F, ClientLoadCapabilities))
@@ -4265,10 +4263,8 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName,
 
   // Setup the import locations and notify the module manager that we've
   // committed to these module files.
-  for (SmallVectorImpl<ImportedModule>::iterator M = Loaded.begin(),
-                                              MEnd = Loaded.end();
-       M != MEnd; ++M) {
-    ModuleFile &F = *M->Mod;
+  for (ImportedModule &M : Loaded) {
+    ModuleFile &F = *M.Mod;
 
     ModuleMgr.moduleFileAccepted(&F);
 
@@ -4276,10 +4272,10 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName,
     F.DirectImportLoc = ImportLoc;
     // FIXME: We assume that locations from PCH / preamble do not need
     // any translation.
-    if (!M->ImportedBy)
-      F.ImportLoc = M->ImportLoc;
+    if (!M.ImportedBy)
+      F.ImportLoc = M.ImportLoc;
     else
-      F.ImportLoc = TranslateSourceLocation(*M->ImportedBy, M->ImportLoc);
+      F.ImportLoc = TranslateSourceLocation(*M.ImportedBy, M.ImportLoc);
   }
 
   if (!PP.getLangOpts().CPlusPlus ||


        


More information about the cfe-commits mailing list