[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

LLVM Continuous Integration via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 07:58:14 PDT 2024


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clangd-ubuntu-tsan` running on `clangd-ubuntu-clang` while building `clang-tools-extra,clang` at step 6 "test-build-clangd-clangd-index-server-clangd-indexer-check-clangd".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/134/builds/5347

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 6 (test-build-clangd-clangd-index-server-clangd-indexer-check-clangd) failure: test (failure)
...
9.199 [94/18/31] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/CanonicalIncludesTests.cpp.o
9.202 [93/18/32] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/CompileCommandsTests.cpp.o
9.203 [92/18/33] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigProviderTests.cpp.o
9.207 [91/18/34] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigYAMLTests.cpp.o
9.232 [90/18/35] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DraftStoreTests.cpp.o
9.234 [89/18/36] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DexTests.cpp.o
9.498 [88/18/37] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DecisionForestTests.cpp.o
9.574 [87/18/38] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/FileDistanceTests.cpp.o
10.933 [86/18/39] Building CXX object tools/clang/tools/extra/clangd/index/dex/dexp/CMakeFiles/dexp.dir/Dexp.cpp.o
17.758 [85/18/40] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigCompileTests.cpp.o
FAILED: tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigCompileTests.cpp.o 
ccache /usr/bin/clang++ -DCARES_STATICLIB -DGOOGLE_PROTOBUF_NO_RTTI=1 -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/tools/clang/tools/extra/clangd/unittests -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd/unittests -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd/../include-cleaner/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/tools/clang/tools/extra/clangd/../clang-tidy -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/tools/clang/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/llvm/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/tools/clang/tools/extra/clangd -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/build/tools/clang/tools/extra/clangd/unittests/../index/remote -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include -I/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googlemock/include -isystem /usr/local/lib/grpc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -gline-tables-only -fsanitize=thread -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigCompileTests.cpp.o -MF tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigCompileTests.cpp.o.d -o tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigCompileTests.cpp.o -c /vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp:308:9: error: no matching constructor for initialization of 'Diag' (aka 'clang::Diagnostic')
  308 |         Diag{&DiagEngine}, Conf.Diagnostics.Suppress, LangOptions()));
      |         ^   ~~~~~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1807:50: note: expanded from macro 'EXPECT_TRUE'
 1807 | #define EXPECT_TRUE(condition) GTEST_EXPECT_TRUE(condition)
      |                                                  ^~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1792:23: note: expanded from macro 'GTEST_EXPECT_TRUE'
 1792 |   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
      |                       ^~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1493:38: note: expanded from macro 'GTEST_TEST_BOOLEAN_'
 1493 |           ::testing::AssertionResult(expression))                     \
      |                                      ^~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang/include/clang/Basic/Diagnostic.h:1487:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'clang::DiagnosticsEngine *' to 'const Diagnostic' for 1st argument
 1487 | class Diagnostic {
      |       ^~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang/include/clang/Basic/Diagnostic.h:1487:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'clang::DiagnosticsEngine *' to 'Diagnostic' for 1st argument
 1487 | class Diagnostic {
      |       ^~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang/include/clang/Basic/Diagnostic.h:1496:3: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
 1496 |   Diagnostic(const DiagnosticsEngine *DO, const DiagnosticBuilder &DiagBuilder);
      |   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang/include/clang/Basic/Diagnostic.h:1497:3: note: candidate constructor not viable: requires 5 arguments, but 1 was provided
 1497 |   Diagnostic(const DiagnosticsEngine *DO, SourceLocation DiagLoc,
      |   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1498 |              unsigned DiagID, const DiagnosticStorage &DiagStorage,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1499 |              StringRef StoredDiagMessage);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp:314:9: error: no matching constructor for initialization of 'Diag' (aka 'clang::Diagnostic')
  314 |         Diag{&DiagEngine}, Conf.Diagnostics.Suppress, LangOptions()));
      |         ^   ~~~~~~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1811:52: note: expanded from macro 'EXPECT_FALSE'
 1811 | #define EXPECT_FALSE(condition) GTEST_EXPECT_FALSE(condition)
      |                                                    ^~~~~~~~~
/vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1795:25: note: expanded from macro 'GTEST_EXPECT_FALSE'
 1795 |   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
      |                         ^~~~~~~~~

```

</details>

https://github.com/llvm/llvm-project/pull/108187


More information about the cfe-commits mailing list