[PATCH] D149461: [NFC] ][CLANG] Fix static code analyzer concerns

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 10:29:47 PDT 2023


Manna added inline comments.


================
Comment at: clang/lib/Serialization/ASTReader.cpp:4428
   // Mark selectors as out of date.
-  for (auto Sel : SelectorGeneration)
+  for (const auto &Sel : SelectorGeneration)
     SelectorOutOfDate[Sel.first] = true;
----------------
Here Object of type is `DenseMapPair`.  `SelectorGeneration`  returns `llvm::DenseMap<Selector, Unsigned>' in `ASTReader.h' file.


================
Comment at: clang/lib/Serialization/ASTWriter.cpp:1781
       unsigned DataLen = 1 + 4 + 4;
-      for (auto ModInfo : Data.KnownHeaders)
+      for (const auto &ModInfo : Data.KnownHeaders)
         if (Writer.getLocalOrImportedSubmoduleID(ModInfo.getModule()))
----------------
Object of type `KnownHeader` returns ` ArrayRef<ModuleMap::KnownHeader>` in `ASTWriter.cpp` file.


================
Comment at: clang/lib/Serialization/ASTWriter.cpp:1887
       // enough information in the module map.
-      for (auto U : M->MissingHeaders) {
+      for (const auto &U : M->MissingHeaders) {
         // Check that we were given enough information to build a module
----------------
This returns ` SmallVector<UnresolvedHeaderDirective, 1>` in `Module.h' file





CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149461/new/

https://reviews.llvm.org/D149461



More information about the cfe-commits mailing list