[PATCH] D43934: [ELF] - Report location for div/mod by zero.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 09:27:10 PST 2018


ruiu added inline comments.


================
Comment at: ELF/ScriptParser.cpp:815-823
     return [=] { return L().getValue() * R().getValue(); };
-  if (Op == "/")
-    return [=] { return div(L(), R()); };
-  if (Op == "%")
-    return [=] { return mod(L(), R()); };
+  if (Op == "/") {
+    std::string Loc = getCurrentLocation();
+    return [=] { return div(L(), R(), Loc); };
+  }
+  if (Op == "%") {
+    std::string Loc = getCurrentLocation();
----------------
grimar wrote:
> ruiu wrote:
> > You probably should inline these functions. They are called only once.
> Do you mean following ?
> 
> `return [=] { return mod(L(), R(), getCurrentLocation()); };`
> 
> It is not the same. Functor is called much later, and location will be unavailable,
> we can't get it from inside.
No what I mean is to inline div and mod here.


https://reviews.llvm.org/D43934





More information about the llvm-commits mailing list