[PATCH] D62933: [lld] Allow args::getInterger to parse args larger than 2^31-1

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 23:05:42 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362770: [lld] Allow args::getInterger to parse args larger than 2^31-1 (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62933?vs=203253&id=203499#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62933/new/

https://reviews.llvm.org/D62933

Files:
  lld/trunk/Common/Args.cpp
  lld/trunk/include/lld/Common/Args.h
  lld/trunk/test/wasm/large-memory.test


Index: lld/trunk/include/lld/Common/Args.h
===================================================================
--- lld/trunk/include/lld/Common/Args.h
+++ lld/trunk/include/lld/Common/Args.h
@@ -25,7 +25,8 @@
 
 llvm::CodeGenOpt::Level getCGOptLevel(int OptLevelLTO);
 
-int getInteger(llvm::opt::InputArgList &Args, unsigned Key, int Default);
+int64_t getInteger(llvm::opt::InputArgList &Args, unsigned Key,
+                   int64_t Default);
 
 std::vector<StringRef> getStrings(llvm::opt::InputArgList &Args, int Id);
 
Index: lld/trunk/test/wasm/large-memory.test
===================================================================
--- lld/trunk/test/wasm/large-memory.test
+++ lld/trunk/test/wasm/large-memory.test
@@ -0,0 +1,5 @@
+RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+
+; Verify we can parse large integers such as when we ask for 2G of total
+; memory.
+RUN: wasm-ld %t.o -o %t.wasm --max-memory=2147483648
Index: lld/trunk/Common/Args.cpp
===================================================================
--- lld/trunk/Common/Args.cpp
+++ lld/trunk/Common/Args.cpp
@@ -26,12 +26,13 @@
   return CodeGenOpt::Default;
 }
 
-int lld::args::getInteger(opt::InputArgList &Args, unsigned Key, int Default) {
+int64_t lld::args::getInteger(opt::InputArgList &Args, unsigned Key,
+                              int64_t Default) {
   auto *A = Args.getLastArg(Key);
   if (!A)
     return Default;
 
-  int V;
+  int64_t V;
   if (to_integer(A->getValue(), V, 10))
     return V;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62933.203499.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190607/5b49ff79/attachment.bin>


More information about the llvm-commits mailing list