[Lldb-commits] [lldb] f939a32 - [lldb] Fix TestImportStdModule on some setups by testing minmax instead of abs

Diana Picus via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 30 01:47:20 PDT 2021


Would this fix https://bugs.llvm.org/show_bug.cgi?id=51446 by any chance?
Should I give it a spin on the release branch?

On Wed, 29 Sept 2021 at 17:04, Raphael Isemann via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

>
> Author: Raphael Isemann
> Date: 2021-09-29T17:03:37+02:00
> New Revision: f939a32e5c483686af16561211d77c06a5579011
>
> URL:
> https://github.com/llvm/llvm-project/commit/f939a32e5c483686af16561211d77c06a5579011
> DIFF:
> https://github.com/llvm/llvm-project/commit/f939a32e5c483686af16561211d77c06a5579011.diff
>
> LOG: [lldb] Fix TestImportStdModule on some setups by testing minmax
> instead of abs
>
> Some downstream forks of LLDB change parts of the test setup in a way that
> causes lldb to somehow resolve `std::abs` (probably to `::abs`). This patch
> changes the tested function here to be `std::minmax` which (hopefully)
> doesn't
> have any identically named functions that LLDB could find and call. Just
> to be
> extra safe this also explicitly specified the template arguments so that in
> case there is a `minmax` non-template function we still don't end up
> calling it
> from this test.
>
> Added:
>
>
> Modified:
>
> lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git
> a/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
> b/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
> index c60e280dd65d6..695d00b08a0f5 100644
> ---
> a/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
> +++
> b/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
> @@ -24,6 +24,8 @@ def test(self):
>          self.runCmd("settings set target.import-std-module true")
>          # Calling some normal std functions that return non-template
> types.
>          self.expect_expr("std::abs(-42)", result_type="int",
> result_value="42")
> +        self.expect_expr("std::minmax<int>(1, 2).first",
> result_type="const int",
> +            result_value="1")
>          self.expect_expr("std::div(2, 1).quot",
>                           result_type="int",
>                           result_value="2")
> @@ -50,7 +52,7 @@ def test_non_cpp_language(self):
>          self.runCmd("settings set target.import-std-module true")
>          # These languages don't support C++ modules, so they shouldn't
>          # be able to evaluate the expression.
> -        self.expect("expr -l C -- std::abs(-42)", error=True)
> -        self.expect("expr -l C99 -- std::abs(-42)", error=True)
> -        self.expect("expr -l C11 -- std::abs(-42)", error=True)
> -        self.expect("expr -l ObjC -- std::abs(-42)", error=True)
> +        self.expect("expr -l C -- std::minmax<int>(1, 2).first",
> error=True)
> +        self.expect("expr -l C99 -- std::minmax<int>(1, 2).first",
> error=True)
> +        self.expect("expr -l C11 -- std::minmax<int>(1, 2).first",
> error=True)
> +        self.expect("expr -l ObjC -- std::minmax<int>(1, 2).first",
> error=True)
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210930/a7abeff4/attachment.html>


More information about the lldb-commits mailing list