[llvm] 52bfb26 - [ADT] Fix a minor build error (#104840)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 18:53:44 PDT 2024
Author: Dmitry Yanovsky
Date: 2024-08-20T10:53:41+09:00
New Revision: 52bfb2611f8d30fae3306c652af7ba5c7e88c147
URL: https://github.com/llvm/llvm-project/commit/52bfb2611f8d30fae3306c652af7ba5c7e88c147
DIFF: https://github.com/llvm/llvm-project/commit/52bfb2611f8d30fae3306c652af7ba5c7e88c147.diff
LOG: [ADT] Fix a minor build error (#104840)
A quick follow-up fix for
https://github.com/llvm/llvm-project/pull/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.
Added:
Modified:
llvm/unittests/ADT/FunctionExtrasTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ADT/FunctionExtrasTest.cpp b/llvm/unittests/ADT/FunctionExtrasTest.cpp
index f64b888dbe1591..9809a92daac724 100644
--- a/llvm/unittests/ADT/FunctionExtrasTest.cpp
+++ b/llvm/unittests/ADT/FunctionExtrasTest.cpp
@@ -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);
More information about the llvm-commits
mailing list