clang  16.0.0git
AvailabilityInfo.h
Go to the documentation of this file.
1 //===- ExtractAPI/AvailabilityInfo.h - Availability Info --------*- 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 /// \file
10 /// This file defines the AvailabilityInfo struct that collects availability
11 /// attributes of a symbol.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_EXTRACTAPI_AVAILABILITY_INFO_H
16 #define LLVM_CLANG_EXTRACTAPI_AVAILABILITY_INFO_H
17 
18 #include "clang/AST/Decl.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/Support/Error.h"
21 #include "llvm/Support/VersionTuple.h"
22 #include "llvm/Support/raw_ostream.h"
23 
24 using llvm::VersionTuple;
25 
26 namespace clang {
27 namespace extractapi {
28 
29 /// Stores availability attributes of a symbol in a given domain.
31  /// The domain for which this availability info item applies
33  VersionTuple Introduced;
34  VersionTuple Deprecated;
35  VersionTuple Obsoleted;
36 
37  AvailabilityInfo() = default;
38 
39  AvailabilityInfo(StringRef Domain, VersionTuple I, VersionTuple D,
40  VersionTuple O)
41  : Domain(Domain), Introduced(I), Deprecated(D), Obsoleted(O) {}
42 };
43 
45 private:
47  AvailabilityList Availabilities;
48 
49  bool UnconditionallyDeprecated = false;
50  bool UnconditionallyUnavailable = false;
51 
52 public:
53  AvailabilitySet(const Decl *Decl);
54  AvailabilitySet() = default;
55 
56  AvailabilityList::const_iterator begin() const {
57  return Availabilities.begin();
58  }
59 
60  AvailabilityList::const_iterator end() const { return Availabilities.end(); }
61 
62  /// Check if the symbol is unconditionally deprecated.
63  ///
64  /// i.e. \code __attribute__((deprecated)) \endcode
65  bool isUnconditionallyDeprecated() const { return UnconditionallyDeprecated; }
66 
67  /// Check if the symbol is unconditionally unavailable.
68  ///
69  /// i.e. \code __attribute__((unavailable)) \endcode
71  return UnconditionallyUnavailable;
72  }
73 
74  /// Determine if this AvailabilitySet represents default availability.
75  bool isDefault() const { return Availabilities.empty(); }
76 };
77 
78 } // namespace extractapi
79 } // namespace clang
80 
81 #endif // LLVM_CLANG_EXTRACTAPI_AVAILABILITY_INFO_H
clang::extractapi::AvailabilityInfo::Introduced
VersionTuple Introduced
Definition: AvailabilityInfo.h:33
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
llvm::SmallVector< AvailabilityInfo, 4 >
clang::extractapi::AvailabilitySet::isUnconditionallyDeprecated
bool isUnconditionallyDeprecated() const
Check if the symbol is unconditionally deprecated.
Definition: AvailabilityInfo.h:65
clang::extractapi::AvailabilitySet::isUnconditionallyUnavailable
bool isUnconditionallyUnavailable() const
Check if the symbol is unconditionally unavailable.
Definition: AvailabilityInfo.h:70
clang::extractapi::AvailabilitySet::begin
AvailabilityList::const_iterator begin() const
Definition: AvailabilityInfo.h:56
Decl.h
clang::extractapi::AvailabilityInfo::Deprecated
VersionTuple Deprecated
Definition: AvailabilityInfo.h:34
clang::extractapi::AvailabilitySet::isDefault
bool isDefault() const
Determine if this AvailabilitySet represents default availability.
Definition: AvailabilityInfo.h:75
clang::extractapi::AvailabilitySet::AvailabilitySet
AvailabilitySet()=default
clang::extractapi::AvailabilityInfo::Obsoleted
VersionTuple Obsoleted
Definition: AvailabilityInfo.h:35
clang::extractapi::AvailabilityInfo::Domain
std::string Domain
The domain for which this availability info item applies.
Definition: AvailabilityInfo.h:32
clang::extractapi::AvailabilitySet::end
AvailabilityList::const_iterator end() const
Definition: AvailabilityInfo.h:60
clang::extractapi::AvailabilityInfo::AvailabilityInfo
AvailabilityInfo(StringRef Domain, VersionTuple I, VersionTuple D, VersionTuple O)
Definition: AvailabilityInfo.h:39
clang::extractapi::AvailabilityInfo
Stores availability attributes of a symbol in a given domain.
Definition: AvailabilityInfo.h:30
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::extractapi::AvailabilitySet
Definition: AvailabilityInfo.h:44
clang
Definition: CalledOnceCheck.h:17
clang::extractapi::AvailabilityInfo::AvailabilityInfo
AvailabilityInfo()=default