Skip to content

[cas] Fix build and tests with -DLLVM_ENABLE_ONDISK_CAS=0 #10317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/test/ClangScanDeps/cas-fs-multiple-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// there will be separate -E, -emit-llvm-bc, -S, and -cc1as jobs, which should
// each result in a "command" in the output.

// REQUIRES: ondisk_cas

// We use an x86_64-apple-darwin target to avoid host-dependent behaviour in
// the driver. Platforms without an integrated assembler have different commands
// REQUIRES: x86-registered-target
Expand Down
2 changes: 2 additions & 0 deletions clang/test/ClangScanDeps/include-tree-multiple-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// there will be separate -E, -emit-llvm-bc, -S, and -cc1as jobs, which should
// each result in a "command" in the output.

// REQUIRES: ondisk_cas

// We use an x86_64-apple-darwin target to avoid host-dependent behaviour in
// the driver. Platforms without an integrated assembler have different commands
// REQUIRES: x86-registered-target
Expand Down
2 changes: 2 additions & 0 deletions clang/test/ClangScanDeps/include-tree-preserve-pch-path.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// REQUIRES: ondisk_cas

// RUN: split-file %s %t
// RUN: sed -e "s|DIR|%/t|g" %t/cdb_pch.json.template > %t/cdb_pch.json
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
Expand Down
2 changes: 2 additions & 0 deletions clang/test/ClangScanDeps/include-tree-working-directory.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// REQUIRES: ondisk_cas

// RUN: rm -rf %t
// RUN: mkdir -p %t/other
// RUN: split-file %s %t
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// REQUIRES: ondisk_cas

// RUN: rm -rf %t
// RUN: mkdir -p %t/other
// RUN: split-file %s %t
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Index/Core/scan-deps-cas.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// REQUIRES: ondisk_cas

// RUN: rm -rf %t

// RUN: c-index-test core --scan-deps -working-dir %S -output-dir=%t -cas-path %t/cas \
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/CAS/OnDiskHashMappedTrie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,7 @@ OnDiskHashMappedTrie::create(const Twine &PathTwine, const Twine &TrieNameTwine,
size_t NumHashBits, uint64_t DataSize,
uint64_t MaxFileSize,
std::optional<uint64_t> NewFileInitialSize,
std::shared_ptr<OnDiskCASLogger> Logger,
std::optional<size_t> NewTableNumRootBits,
std::optional<size_t> NewTableNumSubtrieBits) {
report_fatal_error("not supported");
Expand Down Expand Up @@ -1668,6 +1669,7 @@ struct OnDiskDataAllocator::ImplType {};
Expected<OnDiskDataAllocator> OnDiskDataAllocator::create(
const Twine &Path, const Twine &TableName, uint64_t MaxFileSize,
std::optional<uint64_t> NewFileInitialSize, uint32_t UserHeaderSize,
std::shared_ptr<OnDiskCASLogger> Logger,
function_ref<void(void *)> UserHeaderInit) {
report_fatal_error("not supported");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REQUIRES: ondisk_cas
RUN: rm -rf %t && mkdir -p %t
RUN: split-file %s %t

Expand Down
1 change: 1 addition & 0 deletions llvm/test/DebugInfo/CAS/AArch64/debug_unopt.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; REQUIRES: ondisk_cas
; RUN: llc -debug-info-unopt -O0 --filetype=obj --cas-backend --cas=%t/cas --mccas-casid --mtriple=arm64-apple-darwin %s -o %t/debug_unopt.id
; RUN: llvm-cas-dump --cas=%t/cas --casid-file %t/debug_unopt.id | FileCheck %s

Expand Down
1 change: 1 addition & 0 deletions llvm/test/DebugInfo/CAS/AArch64/multiple_cus.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; REQUIRES: ondisk_cas
; RUN: llc -cas-friendly-debug-info -O0 --filetype=obj --cas-backend --cas=%t/cas --mccas-verify --mtriple=arm64-apple-darwin %s -o %t/multiple_cus.o 2>&1 | FileCheck %s --allow-empty
; CHECK-NOT: error in backend: CASBackend output round-trip verification error

Expand Down
1 change: 1 addition & 0 deletions llvm/test/tools/llvm-cas-dump/basic_debug_test.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; REQUIRES: ondisk_cas
; RUN: rm -rf %t.casdb
; RUN: llc -cas-friendly-debug-info -O0 --filetype=obj --cas-backend --cas=%t.casdb --mccas-casid -o %t.casid %s
; RUN: llvm-cas-dump --cas=%t.casdb --dwarf-sections-only --dwarf-dump --casid-file %t.casid | FileCheck %s --check-prefix=DWARF
Expand Down
1 change: 1 addition & 0 deletions llvm/test/tools/llvm-cas-dump/enums_split.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; REQUIRES: ondisk_cas
; RUN: rm -rf %t.casdb
; RUN: llc -O0 --filetype=obj --cas-backend --cas=%t.casdb --mccas-casid -o %t_DIE.casid %s
; RUN: llvm-cas-dump --cas=%t.casdb --casid-file %t_DIE.casid --die-refs | FileCheck %s --check-prefix=DWARF-DIE
Expand Down
1 change: 1 addition & 0 deletions llvm/test/tools/llvm-cas-dump/stats-dump.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REQUIRES: ondisk_cas
RUN: rm -rf %t && mkdir -p %t
RUN: llc %S/Inputs/stats-dump.ll -O0 --filetype=obj --cas-backend --cas %t/cas --mccas-casid -o %t/stats-dump.id

Expand Down
1 change: 1 addition & 0 deletions llvm/test/tools/llvm-cas-dump/types_split.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; REQUIRES: ondisk_cas
; RUN: rm -rf %t.casdb
; RUN: llc -O0 --filetype=obj --cas-backend --cas=%t.casdb --mccas-casid -o %t_DIE.casid %s
; RUN: llvm-cas-dump --cas=%t.casdb --casid-file %t_DIE.casid --die-refs | FileCheck %s --check-prefix=DWARF-DIE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// REQUIRES: x86-registered-target
// REQUIRES: x86-registered-target, ondisk_cas
// RUN: rm -rf %t && mkdir -p %t
// RUN: llvm-mc -cas %t/cas -cas-backend -mccas-casid -triple x86_64-apple-darwin10 %s -filetype=obj -o %t/test.o
// RUN: cd %t && llvm-cas --ingest --cas %t/cas --casid-file %t/test.o > %t/output.casid
Expand Down
2 changes: 2 additions & 0 deletions llvm/unittests/CAS/BuiltinUnifiedCASDatabasesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using namespace llvm;
using namespace llvm::cas;

#if LLVM_ENABLE_ONDISK_CAS
TEST(BuiltinUnifiedCASDatabases,
MaterializationCheckPreventsGarbageCollection) {
unittest::TempDir Temp("on-disk-unified-cas", /*Unique=*/true);
Expand Down Expand Up @@ -57,3 +58,4 @@ TEST(BuiltinUnifiedCASDatabases,
ASSERT_TRUE(IsMaterialized);
});
}
#endif