[PATCH] D24726: [ELF] - Linkerscript: reimplement readSectionExcludes()

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 16:43:41 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:1081
@@ -1094,2 +1080,3 @@
 
-    V.push_back(next());
+    while (!Error && peek() != ")" && peek() != "EXCLUDE_FILE")
+      V.push_back(next());
----------------
Move `std::vector<StringRef> V` just before this line to minimize the scope of the variable.

================
Comment at: ELF/LinkerScript.cpp:1081
@@ -1094,2 +1080,3 @@
 
-    V.push_back(next());
+    while (!Error && peek() != ")" && peek() != "EXCLUDE_FILE")
+      V.push_back(next());
----------------
ruiu wrote:
> Move `std::vector<StringRef> V` just before this line to minimize the scope of the variable.
Checking for `EXCLUDE_FILE` here seems too arbitrary. What if it is other reserved word such as SORT? I think we don't want to handle EXCLUDE_FILE as a special case. I'd remove `&& peek() == "EXCLUDE_FILE"`.

================
Comment at: ELF/LinkerScript.cpp:1088
@@ -1096,1 +1087,3 @@
+    else
+      setError("no section globs found");
   }
----------------
"section pattern is expected"


https://reviews.llvm.org/D24726





More information about the llvm-commits mailing list