diff options
author | Reid Kleckner <rnk@google.com> | 2025-04-29 06:32:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-29 06:32:03 -0700 |
commit | db2315afa8db1153e3b85d452cd14d5a1b957350 (patch) | |
tree | f951cb6fbeffa29b2b160992f11ff32672cd92c5 /clang/unittests/Frontend | |
parent | 6695976d16d02d72afc249bb5b46d267c1eee458 (diff) | |
download | llvm-db2315afa8db1153e3b85d452cd14d5a1b957350.zip llvm-db2315afa8db1153e3b85d452cd14d5a1b957350.tar.gz llvm-db2315afa8db1153e3b85d452cd14d5a1b957350.tar.bz2 |
[clang] Merge gtest binaries into AllClangUnitTests (#134196)
This reduces the size of the clang/unittests build directory by 64% and
my overall build dir size by 5%. Static linking is the real driving
factor here, but even if the default build configuration used shared
libraries, I don't see why we should be building so many unit test
binaries.
To make the project more approachable for new contributors, I'm
attempting to make the build a bit less resource-intensive. Build
directory size is a common complaint, and this is low-hanging fruit.
I've noticed that incremental builds leave behind the old, stale gtest binaries, and lit will keep running them. This mostly doesn't matter unless they use shared libraries, which will eventually stop working after successive builds. You can clean up the old test binaries with this command in the build directory:
$ find tools/clang/unittests/ -iname '*Tests' -type f | xargs rm
... or you can simply clean the build directory in a more holistic way.
---------
Co-authored-by: Petr Hosek <phosek@google.com>
Diffstat (limited to 'clang/unittests/Frontend')
-rw-r--r-- | clang/unittests/Frontend/OutputStreamTest.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/unittests/Frontend/OutputStreamTest.cpp b/clang/unittests/Frontend/OutputStreamTest.cpp index fa5d726..27d2d7f 100644 --- a/clang/unittests/Frontend/OutputStreamTest.cpp +++ b/clang/unittests/Frontend/OutputStreamTest.cpp @@ -8,11 +8,11 @@ #include "clang/Basic/LangStandard.h" #include "clang/CodeGen/BackendUtil.h" -#include "clang/CodeGen/CodeGenAction.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/FrontendTool/Utils.h" #include "clang/Lex/PreprocessorOptions.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" @@ -23,6 +23,7 @@ using namespace clang::frontend; namespace { TEST(FrontendOutputTests, TestOutputStream) { + llvm::InitializeAllTargetMCs(); auto Invocation = std::make_shared<CompilerInvocation>(); Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("").release()); @@ -47,6 +48,7 @@ TEST(FrontendOutputTests, TestOutputStream) { } TEST(FrontendOutputTests, TestVerboseOutputStreamShared) { + llvm::InitializeAllTargetMCs(); auto Invocation = std::make_shared<CompilerInvocation>(); Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("invalid").release()); @@ -77,6 +79,7 @@ TEST(FrontendOutputTests, TestVerboseOutputStreamOwned) { std::string VerboseBuffer; bool Success; { + llvm::InitializeAllTargetMCs(); auto Invocation = std::make_shared<CompilerInvocation>(); Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("invalid").release()); |