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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 08:44:13 PST 2018


George Rimar via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> +Expr ScriptParser::combine(StringRef Op, Expr L, Expr R) {
>    if (Op == "+")
>      return [=] { return add(L(), R()); };
>    if (Op == "-")
>      return [=] { return sub(L(), R()); };
>    if (Op == "*")
>      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();

getCurrentLocation is pretty expensive. It probably is not critical in
here, but we should probably keep the style of only calling
getCurrentLocation() when there is an error.

Cheers,
Rafael


More information about the llvm-commits mailing list