[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:49:07 PDT 2024


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-aarch64-darwin` running on `doug-worker-5` while building `clang-tools-extra,clang` at step 5 "build-unified-tree".

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

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

```
Step 5 (build-unified-tree) failure: build (failure)
...
895.714 [1589/8/4301] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/CompileCommandsTests.cpp.o
897.020 [1588/8/4302] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/CallHierarchyTests.cpp.o
898.718 [1587/8/4303] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/CodeCompletionStringsTests.cpp.o
898.754 [1586/8/4304] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigProviderTests.cpp.o
898.764 [1585/8/4305] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ClangdLSPServerTests.cpp.o
898.779 [1584/8/4306] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ConfigYAMLTests.cpp.o
898.790 [1583/8/4307] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DecisionForestTests.cpp.o
898.804 [1582/8/4308] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DexTests.cpp.o
898.828 [1581/8/4309] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/DraftStoreTests.cpp.o
899.633 [1580/8/4310] 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_CPP2=yes CCACHE_HASHDIR=yes /opt/homebrew/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/tools/extra/clangd/unittests -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd/unittests -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd/../include-cleaner/include -I/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/tools/extra/clangd/../clang-tidy -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/include -I/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/include -I/Users/buildbot/buildbot-root/aarch64-darwin/build/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd -I/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/tools/extra/clangd -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googlemock/include -isystem /opt/homebrew/include -fPIC -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 -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -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 /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp:308:9: error: no matching constructor for initialization of 'Diag' (aka 'clang::Diagnostic')
        Diag{&DiagEngine}, Conf.Diagnostics.Suppress, LangOptions()));
        ^   ~~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1807:50: note: expanded from macro 'EXPECT_TRUE'
#define EXPECT_TRUE(condition) GTEST_EXPECT_TRUE(condition)
                                                 ^~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1792:23: note: expanded from macro 'GTEST_EXPECT_TRUE'
  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
                      ^~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1493:38: note: expanded from macro 'GTEST_TEST_BOOLEAN_'
          ::testing::AssertionResult(expression))                     \
                                     ^~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/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 clang::Diagnostic' for 1st argument
class Diagnostic {
      ^
/Users/buildbot/buildbot-root/aarch64-darwin/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 'clang::Diagnostic' for 1st argument
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/include/clang/Basic/Diagnostic.h:1496:3: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
  Diagnostic(const DiagnosticsEngine *DO, const DiagnosticBuilder &DiagBuilder);
  ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/include/clang/Basic/Diagnostic.h:1497:3: note: candidate constructor not viable: requires 5 arguments, but 1 was provided
  Diagnostic(const DiagnosticsEngine *DO, SourceLocation DiagLoc,
  ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp:314:9: error: no matching constructor for initialization of 'Diag' (aka 'clang::Diagnostic')
        Diag{&DiagEngine}, Conf.Diagnostics.Suppress, LangOptions()));
        ^   ~~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1811:52: note: expanded from macro 'EXPECT_FALSE'
#define EXPECT_FALSE(condition) GTEST_EXPECT_FALSE(condition)
                                                   ^~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1795:25: note: expanded from macro 'GTEST_EXPECT_FALSE'
  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
                        ^~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1493:38: note: expanded from macro 'GTEST_TEST_BOOLEAN_'
          ::testing::AssertionResult(expression))                     \
                                     ^~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/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 clang::Diagnostic' for 1st argument
class Diagnostic {
      ^

```

</details>

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


More information about the cfe-commits mailing list