Skip to content

Commit 3b6c721

Browse files
committed
[CAS/OnDiskHashMappedTrie] Guard the implementation using LLVM_ENABLE_ONDISK_CAS
Guard the implementation using preprocessor guards that check `LLVM_ENABLE_ONDISK_CAS` but without putting that macro in the `llvm/cas` header.
1 parent 2007c13 commit 3b6c721

File tree

1 file changed

+64
-8
lines changed

1 file changed

+64
-8
lines changed

llvm/lib/CAS/OnDiskHashMappedTrie.cpp

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using namespace llvm;
2222
using namespace llvm::cas;
2323

24+
#if LLVM_ENABLE_ONDISK_CAS
25+
2426
static_assert(sizeof(size_t) == sizeof(uint64_t), "64-bit only");
2527
static_assert(sizeof(std::atomic<int64_t>) == sizeof(uint64_t),
2628
"Requires lock-free 64-bit atomics");
@@ -1115,14 +1117,6 @@ Expected<OnDiskHashMappedTrie> OnDiskHashMappedTrie::create(
11151117
return OnDiskHashMappedTrie(std::make_unique<ImplType>(std::move(Impl)));
11161118
}
11171119

1118-
OnDiskHashMappedTrie::OnDiskHashMappedTrie(std::unique_ptr<ImplType> Impl)
1119-
: Impl(std::move(Impl)) {}
1120-
OnDiskHashMappedTrie::OnDiskHashMappedTrie(OnDiskHashMappedTrie &&RHS) =
1121-
default;
1122-
OnDiskHashMappedTrie &
1123-
OnDiskHashMappedTrie::operator=(OnDiskHashMappedTrie &&RHS) = default;
1124-
OnDiskHashMappedTrie::~OnDiskHashMappedTrie() = default;
1125-
11261120
//===----------------------------------------------------------------------===//
11271121
// DataAllocator data structures.
11281122
//===----------------------------------------------------------------------===//
@@ -1266,6 +1260,68 @@ const char *OnDiskDataAllocator::beginData(FileOffset Offset) const {
12661260

12671261
OnDiskDataAllocator::OnDiskDataAllocator(std::unique_ptr<ImplType> Impl)
12681262
: Impl(std::move(Impl)) {}
1263+
1264+
#else // !LLVM_ENABLE_ONDISK_CAS
1265+
1266+
struct OnDiskHashMappedTrie::ImplType {};
1267+
1268+
Expected<OnDiskHashMappedTrie> OnDiskHashMappedTrie::create(
1269+
const Twine &PathTwine, const Twine &TrieNameTwine, size_t NumHashBits,
1270+
uint64_t DataSize, uint64_t MaxFileSize,
1271+
Optional<uint64_t> NewFileInitialSize, Optional<size_t> NewTableNumRootBits,
1272+
Optional<size_t> NewTableNumSubtrieBits) {
1273+
llvm_unreachable("not supported");
1274+
}
1275+
1276+
OnDiskHashMappedTrie::pointer
1277+
OnDiskHashMappedTrie::insertLazy(const_pointer Hint, ArrayRef<uint8_t> Hash,
1278+
LazyInsertOnConstructCB OnConstruct,
1279+
LazyInsertOnLeakCB OnLeak) {
1280+
llvm_unreachable("not supported");
1281+
}
1282+
1283+
OnDiskHashMappedTrie::const_pointer
1284+
OnDiskHashMappedTrie::recoverFromFileOffset(FileOffset Offset) const {
1285+
llvm_unreachable("not supported");
1286+
}
1287+
1288+
OnDiskHashMappedTrie::const_pointer
1289+
OnDiskHashMappedTrie::find(ArrayRef<uint8_t> Hash) const {
1290+
llvm_unreachable("not supported");
1291+
}
1292+
1293+
void OnDiskHashMappedTrie::print(
1294+
raw_ostream &OS, function_ref<void(ArrayRef<char>)> PrintRecordData) const {
1295+
llvm_unreachable("not supported");
1296+
}
1297+
1298+
struct OnDiskDataAllocator::ImplType {};
1299+
1300+
Expected<OnDiskDataAllocator>
1301+
OnDiskDataAllocator::create(const Twine &PathTwine, const Twine &TableNameTwine,
1302+
uint64_t MaxFileSize,
1303+
Optional<uint64_t> NewFileInitialSize) {
1304+
llvm_unreachable("not supported");
1305+
}
1306+
1307+
OnDiskDataAllocator::pointer OnDiskDataAllocator::allocate(size_t Size) {
1308+
llvm_unreachable("not supported");
1309+
}
1310+
1311+
const char *OnDiskDataAllocator::beginData(FileOffset Offset) const {
1312+
llvm_unreachable("not supported");
1313+
}
1314+
1315+
#endif // LLVM_ENABLE_ONDISK_CAS
1316+
1317+
OnDiskHashMappedTrie::OnDiskHashMappedTrie(std::unique_ptr<ImplType> Impl)
1318+
: Impl(std::move(Impl)) {}
1319+
OnDiskHashMappedTrie::OnDiskHashMappedTrie(OnDiskHashMappedTrie &&RHS) =
1320+
default;
1321+
OnDiskHashMappedTrie &
1322+
OnDiskHashMappedTrie::operator=(OnDiskHashMappedTrie &&RHS) = default;
1323+
OnDiskHashMappedTrie::~OnDiskHashMappedTrie() = default;
1324+
12691325
OnDiskDataAllocator::OnDiskDataAllocator(OnDiskDataAllocator &&RHS) = default;
12701326
OnDiskDataAllocator &
12711327
OnDiskDataAllocator::operator=(OnDiskDataAllocator &&RHS) = default;

0 commit comments

Comments
 (0)