[PATCH] D40408: [LLD] [COFF] Implement numerical sorting of constructors with priority

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 02:17:57 PST 2017


ruiu added inline comments.


================
Comment at: COFF/Writer.cpp:329
 
+static bool orderSections(const StringRef& FullA, const StringRef& FullB) {
+  StringRef A = FullA;
----------------
Please add a comment saying that this is for MinGW. I'd also mention that this could have been technically avoided because we could have used '$' instead of '.', but we do this for compatibility with GNU.


================
Comment at: COFF/Writer.cpp:329
 
+static bool orderSections(const StringRef& FullA, const StringRef& FullB) {
+  StringRef A = FullA;
----------------
ruiu wrote:
> Please add a comment saying that this is for MinGW. I'd also mention that this could have been technically avoided because we could have used '$' instead of '.', but we do this for compatibility with GNU.
Passing a StringRef by reference seems a bit odd. The class is designed to be passed by value, because it is essentially a pointer with size.


================
Comment at: COFF/Writer.cpp:329
 
+static bool orderSections(const StringRef& FullA, const StringRef& FullB) {
+  StringRef A = FullA;
----------------
ruiu wrote:
> ruiu wrote:
> > Please add a comment saying that this is for MinGW. I'd also mention that this could have been technically avoided because we could have used '$' instead of '.', but we do this for compatibility with GNU.
> Passing a StringRef by reference seems a bit odd. The class is designed to be passed by value, because it is essentially a pointer with size.
Can you describe the rule that this function is trying to implement briefly?


https://reviews.llvm.org/D40408





More information about the llvm-commits mailing list