[PATCH] D98837: [lld][MachO] Refactor handling of subsections

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 29 16:13:21 PDT 2021


gkm added inline comments.


================
Comment at: lld/MachO/Driver.cpp:1054-1059
     for (const InputFile *file : inputFiles) {
-      for (const SubsectionMap &map : file->subsections) {
-        for (const auto &p : map) {
-          InputSection *isec = p.second;
-          inputSections.push_back(isec);
-        }
+      for (const SubsectionMapping &map : file->subsections) {
+        for (const SubsectionEntry &subsectionEntry : map)
+          inputSections.push_back(subsectionEntry.isec);
       }
     }
----------------
Nit: only the outer set of braces are necessary according to https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
```
// Use braces on the outer block because there are more than two levels of nesting.
if (isa<FunctionDecl>(D)) {
  for (auto *A : D.attrs())
    for (ssize_t i : llvm::seq<ssize_t>(count))
       handleAttrOnDecl(D, A, i);
}
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98837



More information about the llvm-commits mailing list