Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __filesystem / file_status.h
blob0cf405b9c29e90c32a43491abac9d77f84b27864
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FILESYSTEM_FILE_STATUS_H
11 #define _LIBCPP___FILESYSTEM_FILE_STATUS_H
13 #include <__availability>
14 #include <__config>
15 #include <__filesystem/file_type.h>
16 #include <__filesystem/perms.h>
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 # pragma GCC system_header
20 #endif
22 #ifndef _LIBCPP_CXX03_LANG
24 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
26 class _LIBCPP_EXPORTED_FROM_ABI file_status {
27 public:
28 // constructors
29 _LIBCPP_INLINE_VISIBILITY
30 file_status() noexcept : file_status(file_type::none) {}
31 _LIBCPP_INLINE_VISIBILITY
32 explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
33 : __ft_(__ft),
34 __prms_(__prms) {}
36 _LIBCPP_HIDE_FROM_ABI file_status(const file_status&) noexcept = default;
37 _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
39 _LIBCPP_INLINE_VISIBILITY
40 ~file_status() {}
42 _LIBCPP_HIDE_FROM_ABI file_status& operator=(const file_status&) noexcept = default;
43 _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
45 // observers
46 _LIBCPP_INLINE_VISIBILITY
47 file_type type() const noexcept { return __ft_; }
49 _LIBCPP_INLINE_VISIBILITY
50 perms permissions() const noexcept { return __prms_; }
52 // modifiers
53 _LIBCPP_INLINE_VISIBILITY
54 void type(file_type __ft) noexcept { __ft_ = __ft; }
56 _LIBCPP_INLINE_VISIBILITY
57 void permissions(perms __p) noexcept { __prms_ = __p; }
59 # if _LIBCPP_STD_VER >= 20
61 _LIBCPP_HIDE_FROM_ABI friend bool operator==(const file_status& __lhs, const file_status& __rhs) noexcept {
62 return __lhs.type() == __rhs.type() && __lhs.permissions() == __rhs.permissions();
65 # endif
67 private:
68 file_type __ft_;
69 perms __prms_;
72 _LIBCPP_END_NAMESPACE_FILESYSTEM
74 #endif // _LIBCPP_CXX03_LANG
76 #endif // _LIBCPP___FILESYSTEM_FILE_STATUS_H