[PATCH] D59311: [ELF] Dump symbols ordered by profiled guided section layout to file.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 16:03:05 PDT 2019


ruiu added inline comments.


================
Comment at: lld/ELF/CallGraphSort.cpp:243
+        // and find out a Defined symbol with name that is within the section.
+        for (auto* Symbol: Sections[SecIndex]->File->getSymbols())
+          if (!Symbol->getName().empty())
----------------
We do not use `auto` unless its type is obvious from right-hand side.

`auto* Foo` -> `auto *Foo`


================
Comment at: lld/ELF/CallGraphSort.cpp:246-247
+            if (auto* D = dyn_cast<Defined>(Symbol))
+              if (auto* IS = dyn_cast_or_null<InputSectionBase>(D->Section))
+                if (Sections[SecIndex] == dyn_cast<InputSectionBase>(IS->Repl))
+                  OS << Symbol->getName() << "\n";
----------------
You don't need to cast -- I think you can directly compare `Sections[SecIndex] == D->Section`.


================
Comment at: lld/ELF/Driver.cpp:831
       Args.hasFlag(OPT_print_gc_sections, OPT_no_print_gc_sections, false);
+  Config->PrintSymbolOrderToFile =
+      Args.getLastArgValue(OPT_print_symbol_order);
----------------
Config members has the same name as their corresponding command line options, so please name it `PrintSymbolOrder`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59311





More information about the llvm-commits mailing list