llvm-project/lld/tools/lld
Alexandre Ganea bb8be26a7e [LLD] Fix issue in HIP due to unspecified order of evaluation of the function object
This fixes the issue raised in https://reviews.llvm.org/D108850#3303452

Before C++17, the function object is evaluated in a unspecified order. In the following example: https://godbolt.org/z/8ao4vdsr7 the function object is either evaluated before or after the arguments, depending on the compiler. With MSVC and /std:c++14 the function object is evaluated after the arguments; with clang and gcc, it is evaluated before. With C++17, the function object is guaranteed to be evaluated before the arguments, see: https://riptutorial.com/cplusplus/example/19369/evaluation-order-of-function-arguments

In our case, the issue was that the `args` conversion to `ArrayRef` was evaluated before the lambda call `link`, which internally was calling `parseFlavor()`, which in turned modified `args`. We ended with an `ArrayRef` argument that reflected the previous contents of `args`.

Add coverage for `-flavor` which we didn't have before.

Differential Revision: https://reviews.llvm.org/D119278
2022-02-08 19:12:15 -05:00
..
CMakeLists.txt [lld][CMake] Use `GNUInstallDirs` to support custom installation dirs 2021-12-31 18:57:57 +00:00
lld.cpp [LLD] Fix issue in HIP due to unspecified order of evaluation of the function object 2022-02-08 19:12:15 -05:00