[PATCH] D24194: [ELF] - Linkerscript: add support for suffixes in numbers.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 09:04:46 PDT 2016


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

LGTM with this change.


================
Comment at: ELF/LinkerScript.cpp:1326-1331
@@ -1305,8 +1325,8 @@
   uint64_t V = 0;
-  if (Tok.getAsInteger(0, V)) {
+  if (!readInteger(Tok, V)) {
     if (Tok != "." && !isValidCIdentifier(Tok))
       setError("malformed number: " + Tok);
     return [=](uint64_t Dot) { return getSymbolValue(Tok, Dot); };
   }
   return [=](uint64_t Dot) { return V; };
 }
----------------
Please try to simplify when you flip the meaning of the return value.

  // Tok is a literal number.
  uint64_t V;
  if (readInteger(Tok, V))
    return [=](uint64_t Dot) { return V; };

  // Tok is a symbol name.
  if (Tok != "." && !isValidCIdentifier(Tok))
    setError("malformed number: " + Tok);
  return [=](uint64_t Dot) { return getSymbolValue(Tok, Dot); };


https://reviews.llvm.org/D24194





More information about the llvm-commits mailing list