[PATCH] D23866: [ELF] - Linkerscript: do not use outputsections factory.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 14:32:11 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:263
@@ +262,3 @@
+std::pair<OutputSectionBase<ELFT> *, bool>
+LinkerScript<ELFT>::createOutputSection(InputSectionBase<ELFT> *C,
+                                        StringRef Name) {
----------------
This can be a non-member function now, I guess?

================
Comment at: ELF/LinkerScript.cpp:267
@@ +266,3 @@
+
+  OutputSectionBase<ELFT> *Sec = nullptr;
+  for (std::unique_ptr<OutputSectionBase<ELFT>> &S : OwningSections) {
----------------
Move the variable definition closer to the first use of the variable.

================
Comment at: ELF/LinkerScript.cpp:268
@@ +267,3 @@
+  OutputSectionBase<ELFT> *Sec = nullptr;
+  for (std::unique_ptr<OutputSectionBase<ELFT>> &S : OwningSections) {
+    if (S->getName() == Name)
----------------
Remove {}

================
Comment at: ELF/LinkerScript.h:180
@@ -176,1 +179,3 @@
 
+  std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> OwningSections;
+
----------------
Use `Out<ELFT>::Pool` instead.

================
Comment at: ELF/OutputSections.cpp:1789
@@ +1788,3 @@
+                  typename ELFT::uint Alignment, uint32_t Type) {
+  OutputSectionBase<ELFT> *Sec;
+  switch (Kind) {
----------------
Remove this variable and use early returns.


https://reviews.llvm.org/D23866





More information about the llvm-commits mailing list