[clang] [llvm] [UnitTests] Enable PCH (PR #191402)
Alexis Engelke via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 11:51:58 PDT 2026
https://github.com/aengelke updated https://github.com/llvm/llvm-project/pull/191402
>From 81ed875a0bf5c26c953af35b38ee7e7e588098bb Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 10 Apr 2026 11:46:59 +0000
Subject: [PATCH 1/2] [spr] initial version
Created using spr 1.3.8-wip
---
llvm/cmake/modules/AddLLVM.cmake | 2 +-
llvm/unittests/Support/raw_sha1_ostream_test.cpp | 15 +--------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 0730ba2f529ed..28858db434f91 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1906,7 +1906,7 @@ function(add_unittest test_suite test_name)
endif()
list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
- add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH DISABLE_PCH_REUSE ${ARGN})
+ add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
get_subproject_title(subproject_title)
set_target_properties(${test_name} PROPERTIES FOLDER "${subproject_title}/Tests/Unit")
diff --git a/llvm/unittests/Support/raw_sha1_ostream_test.cpp b/llvm/unittests/Support/raw_sha1_ostream_test.cpp
index a3cb6f58d3e29..be8333237d81d 100644
--- a/llvm/unittests/Support/raw_sha1_ostream_test.cpp
+++ b/llvm/unittests/Support/raw_sha1_ostream_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_sha1_ostream.h"
#include "gtest/gtest.h"
@@ -14,20 +15,6 @@
using namespace llvm;
-static std::string toHex(ArrayRef<uint8_t> Input) {
- static const char *const LUT = "0123456789ABCDEF";
- size_t Length = Input.size();
-
- std::string Output;
- Output.reserve(2 * Length);
- for (size_t i = 0; i < Length; ++i) {
- const unsigned char c = Input[i];
- Output.push_back(LUT[c >> 4]);
- Output.push_back(LUT[c & 15]);
- }
- return Output;
-}
-
TEST(raw_sha1_ostreamTest, Basic) {
llvm::raw_sha1_ostream Sha1Stream;
Sha1Stream << "Hello World!";
>From b35caa465e3daafaeb4dbaffb49a0e5e981e1f45 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 10 Apr 2026 18:51:19 +0000
Subject: [PATCH 2/2] add fixes for unit tests
Created using spr 1.3.8-wip
---
clang/unittests/Basic/CharInfoTest.cpp | 2 +-
clang/unittests/Frontend/CompilerInstanceTest.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/unittests/Basic/CharInfoTest.cpp b/clang/unittests/Basic/CharInfoTest.cpp
index 491c9afceb6f8..5a10942cebca6 100644
--- a/clang/unittests/Basic/CharInfoTest.cpp
+++ b/clang/unittests/Basic/CharInfoTest.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Basic/CharInfo.h"
#include "clang/Basic/CharInfo.h"
#include "gtest/gtest.h"
-using namespace llvm;
using namespace clang;
// Check that the CharInfo table has been constructed reasonably.
diff --git a/clang/unittests/Frontend/CompilerInstanceTest.cpp b/clang/unittests/Frontend/CompilerInstanceTest.cpp
index d36612e72e268..68578a93d75b5 100644
--- a/clang/unittests/Frontend/CompilerInstanceTest.cpp
+++ b/clang/unittests/Frontend/CompilerInstanceTest.cpp
@@ -173,7 +173,7 @@ TEST(CompilerInstance, SingleModuleParseModeCallback) {
std::vector<std::string> &SkippedModules;
ModuleLoadSkippedCallback(std::vector<std::string> &SkippedModules)
: SkippedModules(SkippedModules) {}
- void moduleLoadSkipped(Module *Skipped) override {
+ void moduleLoadSkipped(clang::Module *Skipped) override {
SkippedModules.emplace_back(Skipped->getFullModuleName());
}
};
More information about the cfe-commits
mailing list