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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 09:30:05 PST 2018


grimar 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();
----------------
ruiu wrote:
> 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.
Ah, OK. Will update diff tomorrow with that change, thanks !


https://reviews.llvm.org/D43934





More information about the llvm-commits mailing list