[lld] r322453 - Remove dead code.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 13 20:44:21 PST 2018


Author: ruiu
Date: Sat Jan 13 20:44:21 2018
New Revision: 322453

URL: http://llvm.org/viewvc/llvm-project?rev=322453&view=rev
Log:
Remove dead code.

parseInt assumed that it could take a negative number literal (e.g.
"-123"). However, such number is in reality already handled as a
unary operator '-' followed by a number literal, so the number
literal is always non-negative. Thus, this code is dead.

Modified:
    lld/trunk/ELF/ScriptParser.cpp

Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=322453&r1=322452&r2=322453&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Sat Jan 13 20:44:21 2018
@@ -880,13 +880,6 @@ Expr ScriptParser::readConstant() {
 // "0x" or suffixed with "H") and decimal numbers. Decimal numbers may
 // have "K" (Ki) or "M" (Mi) suffixes.
 static Optional<uint64_t> parseInt(StringRef Tok) {
-  // Negative number
-  if (Tok.startswith("-")) {
-    if (Optional<uint64_t> Val = parseInt(Tok.substr(1)))
-      return -*Val;
-    return None;
-  }
-
   // Hexadecimal
   uint64_t Val;
   if (Tok.startswith_lower("0x")) {




More information about the llvm-commits mailing list