LLVM  14.0.0git
UniqueID.h
Go to the documentation of this file.
1 //===- llvm/Support/FileSystem/UniqueID.h - UniqueID for files --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is cut out of llvm/Support/FileSystem.h to allow UniqueID to be
10 // reused without bloating the includes.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_SUPPORT_FILESYSTEM_UNIQUEID_H
15 #define LLVM_SUPPORT_FILESYSTEM_UNIQUEID_H
16 
17 #include <cstdint>
18 
19 namespace llvm {
20 namespace sys {
21 namespace fs {
22 
23 class UniqueID {
24  uint64_t Device;
25  uint64_t File;
26 
27 public:
28  UniqueID() = default;
29  UniqueID(uint64_t Device, uint64_t File) : Device(Device), File(File) {}
30 
31  bool operator==(const UniqueID &Other) const {
32  return Device == Other.Device && File == Other.File;
33  }
34  bool operator!=(const UniqueID &Other) const { return !(*this == Other); }
35  bool operator<(const UniqueID &Other) const {
36  /// Don't use std::tie since it bloats the compile time of this header.
37  if (Device < Other.Device)
38  return true;
39  if (Other.Device < Device)
40  return false;
41  return File < Other.File;
42  }
43 
44  uint64_t getDevice() const { return Device; }
45  uint64_t getFile() const { return File; }
46 };
47 
48 } // end namespace fs
49 } // end namespace sys
50 } // end namespace llvm
51 
52 #endif // LLVM_SUPPORT_FILESYSTEM_UNIQUEID_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::sys::fs::UniqueID::UniqueID
UniqueID(uint64_t Device, uint64_t File)
Definition: UniqueID.h:29
llvm::sys::fs::UniqueID::getFile
uint64_t getFile() const
Definition: UniqueID.h:45
llvm::sys::fs::UniqueID
Definition: UniqueID.h:23
uint64_t
llvm::sys::fs::UniqueID::UniqueID
UniqueID()=default
llvm::sys::fs::UniqueID::operator<
bool operator<(const UniqueID &Other) const
Definition: UniqueID.h:35
llvm::sys::fs::UniqueID::operator==
bool operator==(const UniqueID &Other) const
Definition: UniqueID.h:31
llvm::sys::fs::UniqueID::getDevice
uint64_t getDevice() const
Definition: UniqueID.h:44
llvm::sys::fs::UniqueID::operator!=
bool operator!=(const UniqueID &Other) const
Definition: UniqueID.h:34
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1175