Skip to content

Commit

Permalink
[ADT] Fix a minor build error (llvm#104840)
Browse files Browse the repository at this point in the history
A quick follow-up fix for
llvm#99403

Buildbot
[reported](https://lab.llvm.org/buildbot/#/builders/168/builds/2330) an
error:

```
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp:320:8: error: variable 'ptr' is uninitialized when used here [-Werror,-Wuninitialized]
  320 |       [ptr](void *self) {
      |        ^~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ADT/FunctionExtrasTest.cpp:318:12: note: initialize the variable 'ptr' to silence this warning
  318 |   void *ptr;
      |            ^
      |             = nullptr
1 error generated.
```

So that PR does exactly what's sugested.
  • Loading branch information
kerambyte authored Aug 20, 2024
1 parent d3864d9 commit 52bfb26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/unittests/ADT/FunctionExtrasTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ TEST(UniqueFunctionTest, InlineStorageWorks) {
// We do assume a couple of implementation details of the unique_function here:
// - It can store certain small-enough payload inline
// - Inline storage size is at least >= sizeof(void*)
void *ptr;
void *ptr = nullptr;
unique_function<void(void *)> UniqueFunctionWithInlineStorage{
[ptr](void *self) {
auto mid = reinterpret_cast<uintptr_t>(&ptr);
Expand Down

0 comments on commit 52bfb26

Please sign in to comment.