[PATCH] D22977: [LinkerScript] Support decimal values for filler

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 15:20:32 PDT 2016


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits.


================
Comment at: ELF/LinkerScript.cpp:802
@@ -801,3 +801,3 @@
     return {};
-  if (!Tok.startswith("=0x")) {
-    setError("filler should be a hexadecimal value");
+  if (Tok.startswith("=0x")) {
+    next();
----------------
At this point, we determined we consume a token whether it's a hexadecimal or decimal, so let's move next() here, so that you can remove the following two next()s.

================
Comment at: ELF/LinkerScript.cpp:808
@@ +807,3 @@
+  Tok = Tok.substr(1);
+  unsigned char Value;
+  if (Tok.getAsInteger(10, Value)) {
----------------
This should be an unsigned int. Otherwise `Value > 255` is always false.

================
Comment at: ELF/LinkerScript.cpp:809
@@ +808,3 @@
+  unsigned char Value;
+  if (Tok.getAsInteger(10, Value)) {
+    setError("filler should be a decimal/hexadecimal value");
----------------
This can be `Tok.substr(1).getAsInteger`


https://reviews.llvm.org/D22977





More information about the llvm-commits mailing list