clang  15.0.0git
Types.h
Go to the documentation of this file.
1 //===-- Types.h - API Notes Data Types --------------------------*- 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 #ifndef LLVM_CLANG_APINOTES_TYPES_H
10 #define LLVM_CLANG_APINOTES_TYPES_H
11 
12 #include "clang/Basic/Specifiers.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringRef.h"
15 #include <climits>
16 #include <vector>
17 
18 namespace clang {
19 namespace api_notes {
21  None,
26 };
27 
28 /// The payload for an enum_extensibility attribute. This is a tri-state rather
29 /// than just a boolean because the presence of the attribute indicates
30 /// auditing.
32  None,
33  Open,
34  Closed,
35 };
36 
37 /// The kind of a swift_wrapper/swift_newtype.
38 enum class SwiftNewTypeKind {
39  None,
40  Struct,
41  Enum,
42 };
43 
44 /// Describes API notes data for any entity.
45 ///
46 /// This is used as the base of all API notes.
48 public:
49  /// Message to use when this entity is unavailable.
51 
52  /// Whether this entity is marked unavailable.
53  unsigned Unavailable : 1;
54 
55  /// Whether this entity is marked unavailable in Swift.
56  unsigned UnavailableInSwift : 1;
57 
58 private:
59  /// Whether SwiftPrivate was specified.
60  unsigned SwiftPrivateSpecified : 1;
61 
62  /// Whether this entity is considered "private" to a Swift overlay.
63  unsigned SwiftPrivate : 1;
64 
65 public:
66  /// Swift name of this entity.
68 
70  : Unavailable(0), UnavailableInSwift(0), SwiftPrivateSpecified(0),
71  SwiftPrivate(0) {}
72 
74  return SwiftPrivateSpecified ? llvm::Optional<bool>(SwiftPrivate)
75  : llvm::None;
76  }
77 
79  SwiftPrivateSpecified = Private.hasValue();
80  SwiftPrivate = Private.hasValue() ? *Private : 0;
81  }
82 
83  friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &);
84 
86  // Merge unavailability.
87  if (RHS.Unavailable) {
88  Unavailable = true;
89  if (UnavailableMsg.empty())
91  }
92 
93  if (RHS.UnavailableInSwift) {
94  UnavailableInSwift = true;
95  if (UnavailableMsg.empty())
97  }
98 
99  if (!SwiftPrivateSpecified)
101 
102  if (SwiftName.empty())
103  SwiftName = RHS.SwiftName;
104 
105  return *this;
106  }
107 
108  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
109 };
110 
111 inline bool operator==(const CommonEntityInfo &LHS,
112  const CommonEntityInfo &RHS) {
113  return LHS.UnavailableMsg == RHS.UnavailableMsg &&
114  LHS.Unavailable == RHS.Unavailable &&
116  LHS.SwiftPrivateSpecified == RHS.SwiftPrivateSpecified &&
117  LHS.SwiftPrivate == RHS.SwiftPrivate && LHS.SwiftName == RHS.SwiftName;
118 }
119 
120 inline bool operator!=(const CommonEntityInfo &LHS,
121  const CommonEntityInfo &RHS) {
122  return !(LHS == RHS);
123 }
124 
125 /// Describes API notes for types.
127  /// The Swift type to which a given type is bridged.
128  ///
129  /// Reflects the swift_bridge attribute.
130  llvm::Optional<std::string> SwiftBridge;
131 
132  /// The NS error domain for this type.
133  llvm::Optional<std::string> NSErrorDomain;
134 
135 public:
137 
139  return SwiftBridge;
140  }
141 
143  SwiftBridge = SwiftType;
144  }
145 
147  SwiftBridge = SwiftType
149  : llvm::None;
150  }
151 
153  return NSErrorDomain;
154  }
155 
157  NSErrorDomain = Domain;
158  }
159 
161  NSErrorDomain =
163  }
164 
165  friend bool operator==(const CommonTypeInfo &, const CommonTypeInfo &);
166 
168  // Merge inherited info.
169  static_cast<CommonEntityInfo &>(*this) |= RHS;
170 
171  if (!SwiftBridge)
173  if (!NSErrorDomain)
175 
176  return *this;
177  }
178 
179  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
180 };
181 
182 inline bool operator==(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
183  return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
184  LHS.SwiftBridge == RHS.SwiftBridge &&
185  LHS.NSErrorDomain == RHS.NSErrorDomain;
186 }
187 
188 inline bool operator!=(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
189  return !(LHS == RHS);
190 }
191 
192 /// Describes API notes data for an Objective-C class or protocol.
194  /// Whether this class has a default nullability.
195  unsigned HasDefaultNullability : 1;
196 
197  /// The default nullability.
198  unsigned DefaultNullability : 2;
199 
200  /// Whether this class has designated initializers recorded.
201  unsigned HasDesignatedInits : 1;
202 
203  unsigned SwiftImportAsNonGenericSpecified : 1;
204  unsigned SwiftImportAsNonGeneric : 1;
205 
206  unsigned SwiftObjCMembersSpecified : 1;
207  unsigned SwiftObjCMembers : 1;
208 
209 public:
211  : HasDefaultNullability(0), DefaultNullability(0), HasDesignatedInits(0),
212  SwiftImportAsNonGenericSpecified(false), SwiftImportAsNonGeneric(false),
213  SwiftObjCMembersSpecified(false), SwiftObjCMembers(false) {}
214 
215  /// Determine the default nullability for properties and methods of this
216  /// class.
217  ///
218  /// eturns the default nullability, if implied, or None if there is no
220  return HasDefaultNullability
222  static_cast<NullabilityKind>(DefaultNullability))
223  : llvm::None;
224  }
225 
226  /// Set the default nullability for properties and methods of this class.
228  HasDefaultNullability = true;
229  DefaultNullability = static_cast<unsigned>(Kind);
230  }
231 
232  bool hasDesignatedInits() const { return HasDesignatedInits; }
233  void setHasDesignatedInits(bool Value) { HasDesignatedInits = Value; }
234 
236  return SwiftImportAsNonGenericSpecified
237  ? llvm::Optional<bool>(SwiftImportAsNonGeneric)
238  : llvm::None;
239  }
241  SwiftImportAsNonGenericSpecified = Value.hasValue();
242  SwiftImportAsNonGeneric = Value.getValueOr(false);
243  }
244 
246  return SwiftObjCMembersSpecified ? llvm::Optional<bool>(SwiftObjCMembers)
247  : llvm::None;
248  }
250  SwiftObjCMembersSpecified = Value.hasValue();
251  SwiftObjCMembers = Value.getValueOr(false);
252  }
253 
254  /// Strip off any information within the class information structure that is
255  /// module-local, such as 'audited' flags.
257  HasDefaultNullability = false;
258  DefaultNullability = 0;
259  }
260 
261  friend bool operator==(const ObjCContextInfo &, const ObjCContextInfo &);
262 
264  // Merge inherited info.
265  static_cast<CommonTypeInfo &>(*this) |= RHS;
266 
267  // Merge nullability.
268  if (!getDefaultNullability())
269  if (auto Nullability = RHS.getDefaultNullability())
271 
272  if (!SwiftImportAsNonGenericSpecified)
274 
275  if (!SwiftObjCMembersSpecified)
277 
278  HasDesignatedInits |= RHS.HasDesignatedInits;
279 
280  return *this;
281  }
282 
283  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
284 };
285 
286 inline bool operator==(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) {
287  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
289  LHS.HasDesignatedInits == RHS.HasDesignatedInits &&
292 }
293 
294 inline bool operator!=(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) {
295  return !(LHS == RHS);
296 }
297 
298 /// API notes for a variable/property.
300  /// Whether this property has been audited for nullability.
301  unsigned NullabilityAudited : 1;
302 
303  /// The kind of nullability for this property. Only valid if the nullability
304  /// has been audited.
305  unsigned Nullable : 2;
306 
307  /// The C type of the variable, as a string.
309 
310 public:
311  VariableInfo() : NullabilityAudited(false), Nullable(0) {}
312 
314  return NullabilityAudited ? llvm::Optional<NullabilityKind>(
315  static_cast<NullabilityKind>(Nullable))
316  : llvm::None;
317  }
318 
320  NullabilityAudited = true;
321  Nullable = static_cast<unsigned>(kind);
322  }
323 
324  const std::string &getType() const { return Type; }
325  void setType(const std::string &type) { Type = type; }
326 
327  friend bool operator==(const VariableInfo &, const VariableInfo &);
328 
330  static_cast<CommonEntityInfo &>(*this) |= RHS;
331 
332  if (!NullabilityAudited && RHS.NullabilityAudited)
334  if (Type.empty())
335  Type = RHS.Type;
336 
337  return *this;
338  }
339 
340  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
341 };
342 
343 inline bool operator==(const VariableInfo &LHS, const VariableInfo &RHS) {
344  return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
345  LHS.NullabilityAudited == RHS.NullabilityAudited &&
346  LHS.Nullable == RHS.Nullable && LHS.Type == RHS.Type;
347 }
348 
349 inline bool operator!=(const VariableInfo &LHS, const VariableInfo &RHS) {
350  return !(LHS == RHS);
351 }
352 
353 /// Describes API notes data for an Objective-C property.
355  unsigned SwiftImportAsAccessorsSpecified : 1;
356  unsigned SwiftImportAsAccessors : 1;
357 
358 public:
360  : SwiftImportAsAccessorsSpecified(false), SwiftImportAsAccessors(false) {}
361 
363  return SwiftImportAsAccessorsSpecified
364  ? llvm::Optional<bool>(SwiftImportAsAccessors)
365  : llvm::None;
366  }
368  SwiftImportAsAccessorsSpecified = Value.hasValue();
369  SwiftImportAsAccessors = Value.getValueOr(false);
370  }
371 
372  friend bool operator==(const ObjCPropertyInfo &, const ObjCPropertyInfo &);
373 
374  /// Merge class-wide information into the given property.
376  static_cast<CommonEntityInfo &>(*this) |= RHS;
377 
378  // Merge nullability.
379  if (!getNullability())
380  if (auto Nullable = RHS.getDefaultNullability())
382 
383  return *this;
384  }
385 
387  static_cast<VariableInfo &>(*this) |= RHS;
388 
389  if (!SwiftImportAsAccessorsSpecified)
391 
392  return *this;
393  }
394 
395  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
396 };
397 
398 inline bool operator==(const ObjCPropertyInfo &LHS,
399  const ObjCPropertyInfo &RHS) {
400  return static_cast<const VariableInfo &>(LHS) == RHS &&
402 }
403 
404 inline bool operator!=(const ObjCPropertyInfo &LHS,
405  const ObjCPropertyInfo &RHS) {
406  return !(LHS == RHS);
407 }
408 
409 /// Describes a function or method parameter.
410 class ParamInfo : public VariableInfo {
411  /// Whether noescape was specified.
412  unsigned NoEscapeSpecified : 1;
413 
414  /// Whether the this parameter has the 'noescape' attribute.
415  unsigned NoEscape : 1;
416 
417  /// A biased RetainCountConventionKind, where 0 means "unspecified".
418  ///
419  /// Only relevant for out-parameters.
420  unsigned RawRetainCountConvention : 3;
421 
422 public:
424  : NoEscapeSpecified(false), NoEscape(false), RawRetainCountConvention() {}
425 
427  if (!NoEscapeSpecified)
428  return llvm::None;
429  return NoEscape;
430  }
432  NoEscapeSpecified = Value.hasValue();
433  NoEscape = Value.getValueOr(false);
434  }
435 
437  if (!RawRetainCountConvention)
438  return llvm::None;
439  return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
440  }
441  void
443  RawRetainCountConvention =
444  Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
445  assert(getRetainCountConvention() == Value && "bitfield too small");
446  }
447 
449  static_cast<VariableInfo &>(*this) |= RHS;
450 
451  if (!NoEscapeSpecified && RHS.NoEscapeSpecified) {
452  NoEscapeSpecified = true;
453  NoEscape = RHS.NoEscape;
454  }
455 
456  if (!RawRetainCountConvention)
457  RawRetainCountConvention = RHS.RawRetainCountConvention;
458 
459  return *this;
460  }
461 
462  friend bool operator==(const ParamInfo &, const ParamInfo &);
463 
464  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
465 };
466 
467 inline bool operator==(const ParamInfo &LHS, const ParamInfo &RHS) {
468  return static_cast<const VariableInfo &>(LHS) == RHS &&
469  LHS.NoEscapeSpecified == RHS.NoEscapeSpecified &&
470  LHS.NoEscape == RHS.NoEscape &&
471  LHS.RawRetainCountConvention == RHS.RawRetainCountConvention;
472 }
473 
474 inline bool operator!=(const ParamInfo &LHS, const ParamInfo &RHS) {
475  return !(LHS == RHS);
476 }
477 
478 /// API notes for a function or method.
480 private:
481  static constexpr const unsigned NullabilityKindMask = 0x3;
482  static constexpr const unsigned NullabilityKindSize = 2;
483 
484  static constexpr const unsigned ReturnInfoIndex = 0;
485 
486 public:
487  // If yes, we consider all types to be non-nullable unless otherwise noted.
488  // If this flag is not set, the pointer types are considered to have
489  // unknown nullability.
490 
491  /// Whether the signature has been audited with respect to nullability.
492  unsigned NullabilityAudited : 1;
493 
494  /// Number of types whose nullability is encoded with the NullabilityPayload.
495  unsigned NumAdjustedNullable : 8;
496 
497  /// A biased RetainCountConventionKind, where 0 means "unspecified".
499 
500  // NullabilityKindSize bits are used to encode the nullability. The info
501  // about the return type is stored at position 0, followed by the nullability
502  // of the parameters.
503 
504  /// Stores the nullability of the return type and the parameters.
505  uint64_t NullabilityPayload = 0;
506 
507  /// The result type of this function, as a C type.
509 
510  /// The function parameters.
511  std::vector<ParamInfo> Params;
512 
516 
517  static unsigned getMaxNullabilityIndex() {
518  return ((sizeof(NullabilityPayload) * CHAR_BIT) / NullabilityKindSize);
519  }
520 
521  void addTypeInfo(unsigned index, NullabilityKind kind) {
522  assert(index <= getMaxNullabilityIndex());
523  assert(static_cast<unsigned>(kind) < NullabilityKindMask);
524 
525  NullabilityAudited = true;
526  if (NumAdjustedNullable < index + 1)
527  NumAdjustedNullable = index + 1;
528 
529  // Mask the bits.
531  ~(NullabilityKindMask << (index * NullabilityKindSize));
532 
533  // Set the value.
534  unsigned kindValue = (static_cast<unsigned>(kind))
535  << (index * NullabilityKindSize);
536  NullabilityPayload |= kindValue;
537  }
538 
539  /// Adds the return type info.
541  addTypeInfo(ReturnInfoIndex, kind);
542  }
543 
544  /// Adds the parameter type info.
545  void addParamTypeInfo(unsigned index, NullabilityKind kind) {
546  addTypeInfo(index + 1, kind);
547  }
548 
549  NullabilityKind getParamTypeInfo(unsigned index) const {
550  return getTypeInfo(index + 1);
551  }
552 
553  NullabilityKind getReturnTypeInfo() const { return getTypeInfo(0); }
554 
557  return llvm::None;
558  return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
559  }
560  void
563  Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
564  assert(getRetainCountConvention() == Value && "bitfield too small");
565  }
566 
567  friend bool operator==(const FunctionInfo &, const FunctionInfo &);
568 
569 private:
570  NullabilityKind getTypeInfo(unsigned index) const {
571  assert(NullabilityAudited &&
572  "Checking the type adjustment on non-audited method.");
573 
574  // If we don't have info about this parameter, return the default.
575  if (index > NumAdjustedNullable)
577  auto nullability = NullabilityPayload >> (index * NullabilityKindSize);
578  return static_cast<NullabilityKind>(nullability & NullabilityKindMask);
579  }
580 
581 public:
582  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
583 };
584 
585 inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
586  return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
590  LHS.ResultType == RHS.ResultType && LHS.Params == RHS.Params &&
592 }
593 
594 inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {
595  return !(LHS == RHS);
596 }
597 
598 /// Describes API notes data for an Objective-C method.
599 class ObjCMethodInfo : public FunctionInfo {
600 public:
601  /// Whether this is a designated initializer of its class.
602  unsigned DesignatedInit : 1;
603 
604  /// Whether this is a required initializer.
605  unsigned RequiredInit : 1;
606 
608 
609  friend bool operator==(const ObjCMethodInfo &, const ObjCMethodInfo &);
610 
612  // Merge Nullability.
613  if (!NullabilityAudited) {
614  if (auto Nullable = RHS.getDefaultNullability()) {
615  NullabilityAudited = true;
616  addTypeInfo(0, *Nullable);
617  }
618  }
619  return *this;
620  }
621 
622  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
623 };
624 
625 inline bool operator==(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) {
626  return static_cast<const FunctionInfo &>(LHS) == RHS &&
627  LHS.DesignatedInit == RHS.DesignatedInit &&
628  LHS.RequiredInit == RHS.RequiredInit;
629 }
630 
631 inline bool operator!=(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) {
632  return !(LHS == RHS);
633 }
634 
635 /// Describes API notes data for a global variable.
637 public:
639 };
640 
641 /// Describes API notes data for a global function.
643 public:
645 };
646 
647 /// Describes API notes data for an enumerator.
649 public:
651 };
652 
653 /// Describes API notes data for a tag.
654 class TagInfo : public CommonTypeInfo {
655  unsigned HasFlagEnum : 1;
656  unsigned IsFlagEnum : 1;
657 
658 public:
660 
661  TagInfo() : HasFlagEnum(0), IsFlagEnum(0) {}
662 
664  if (HasFlagEnum)
665  return IsFlagEnum;
666  return llvm::None;
667  }
669  HasFlagEnum = Value.hasValue();
670  IsFlagEnum = Value.getValueOr(false);
671  }
672 
673  TagInfo &operator|=(const TagInfo &RHS) {
674  static_cast<CommonTypeInfo &>(*this) |= RHS;
675 
676  if (!HasFlagEnum && HasFlagEnum)
677  setFlagEnum(RHS.isFlagEnum());
678 
679  if (!EnumExtensibility.hasValue())
681 
682  return *this;
683  }
684 
685  friend bool operator==(const TagInfo &, const TagInfo &);
686 
687  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
688 };
689 
690 inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) {
691  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
692  LHS.isFlagEnum() == RHS.isFlagEnum() &&
694 }
695 
696 inline bool operator!=(const TagInfo &LHS, const TagInfo &RHS) {
697  return !(LHS == RHS);
698 }
699 
700 /// Describes API notes data for a typedef.
701 class TypedefInfo : public CommonTypeInfo {
702 public:
704 
706 
708  static_cast<CommonTypeInfo &>(*this) |= RHS;
709  if (!SwiftWrapper.hasValue())
711  return *this;
712  }
713 
714  friend bool operator==(const TypedefInfo &, const TypedefInfo &);
715 
716  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
717 };
718 
719 inline bool operator==(const TypedefInfo &LHS, const TypedefInfo &RHS) {
720  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
721  LHS.SwiftWrapper == RHS.SwiftWrapper;
722 }
723 
724 inline bool operator!=(const TypedefInfo &LHS, const TypedefInfo &RHS) {
725  return !(LHS == RHS);
726 }
727 } // namespace api_notes
728 } // namespace clang
729 
730 #endif
clang::api_notes::GlobalFunctionInfo
Describes API notes data for a global function.
Definition: Types.h:642
clang::api_notes::TagInfo
Describes API notes data for a tag.
Definition: Types.h:654
clang::api_notes::ObjCMethodInfo::RequiredInit
unsigned RequiredInit
Whether this is a required initializer.
Definition: Types.h:605
clang::api_notes::ObjCPropertyInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:57
Specifiers.h
clang::api_notes::CommonTypeInfo::CommonTypeInfo
CommonTypeInfo()
Definition: Types.h:136
clang::api_notes::VariableInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:48
type
clang::api_notes::ParamInfo::setRetainCountConvention
void setRetainCountConvention(llvm::Optional< RetainCountConventionKind > Value)
Definition: Types.h:442
clang::api_notes::TypedefInfo
Describes API notes data for a typedef.
Definition: Types.h:701
clang::api_notes::VariableInfo::operator==
friend bool operator==(const VariableInfo &, const VariableInfo &)
Definition: Types.h:343
clang::api_notes::FunctionInfo::getParamTypeInfo
NullabilityKind getParamTypeInfo(unsigned index) const
Definition: Types.h:549
clang::ento::Nullability
Nullability
Definition: CheckerHelpers.h:55
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::api_notes::ObjCContextInfo::operator==
friend bool operator==(const ObjCContextInfo &, const ObjCContextInfo &)
Definition: Types.h:286
clang::api_notes::SwiftNewTypeKind::None
@ None
clang::api_notes::FunctionInfo::getRetainCountConvention
llvm::Optional< RetainCountConventionKind > getRetainCountConvention() const
Definition: Types.h:555
clang::api_notes::TypedefInfo::SwiftWrapper
llvm::Optional< SwiftNewTypeKind > SwiftWrapper
Definition: Types.h:703
clang::api_notes::FunctionInfo::addTypeInfo
void addTypeInfo(unsigned index, NullabilityKind kind)
Definition: Types.h:521
clang::api_notes::CommonEntityInfo
Describes API notes data for any entity.
Definition: Types.h:47
clang::api_notes::CommonEntityInfo::Unavailable
unsigned Unavailable
Whether this entity is marked unavailable.
Definition: Types.h:53
CHAR_BIT
#define CHAR_BIT
Definition: limits.h:63
clang::api_notes::ObjCContextInfo::setDefaultNullability
void setDefaultNullability(NullabilityKind Kind)
Set the default nullability for properties and methods of this class.
Definition: Types.h:227
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:773
clang::api_notes::EnumExtensibilityKind::Closed
@ Closed
clang::api_notes::ParamInfo::ParamInfo
ParamInfo()
Definition: Types.h:423
clang::api_notes::ObjCContextInfo::setHasDesignatedInits
void setHasDesignatedInits(bool Value)
Definition: Types.h:233
clang::ShaderStage::Domain
@ Domain
clang::api_notes::RetainCountConventionKind
RetainCountConventionKind
Definition: Types.h:20
llvm::Optional< bool >
clang::api_notes::GlobalVariableInfo
Describes API notes data for a global variable.
Definition: Types.h:636
clang::api_notes::ObjCContextInfo::hasDesignatedInits
bool hasDesignatedInits() const
Definition: Types.h:232
clang::api_notes::EnumExtensibilityKind
EnumExtensibilityKind
The payload for an enum_extensibility attribute.
Definition: Types.h:31
clang::api_notes::TagInfo::EnumExtensibility
llvm::Optional< EnumExtensibilityKind > EnumExtensibility
Definition: Types.h:659
clang::api_notes::VariableInfo
API notes for a variable/property.
Definition: Types.h:299
clang::api_notes::CommonTypeInfo::getSwiftBridge
const llvm::Optional< std::string > & getSwiftBridge() const
Definition: Types.h:138
clang::api_notes::ParamInfo::operator==
friend bool operator==(const ParamInfo &, const ParamInfo &)
Definition: Types.h:467
clang::api_notes::CommonEntityInfo::operator==
friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &)
Definition: Types.h:111
clang::api_notes::RetainCountConventionKind::NSReturnsRetained
@ NSReturnsRetained
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1500
clang::api_notes::ObjCContextInfo::setSwiftImportAsNonGeneric
void setSwiftImportAsNonGeneric(llvm::Optional< bool > Value)
Definition: Types.h:240
clang::api_notes::TagInfo::TagInfo
TagInfo()
Definition: Types.h:661
clang::api_notes::CommonTypeInfo::setNSErrorDomain
void setNSErrorDomain(const llvm::Optional< std::string > &Domain)
Definition: Types.h:156
clang::api_notes::ObjCMethodInfo::DesignatedInit
unsigned DesignatedInit
Whether this is a designated initializer of its class.
Definition: Types.h:602
clang::api_notes::ObjCMethodInfo
Describes API notes data for an Objective-C method.
Definition: Types.h:599
clang::api_notes::ObjCMethodInfo::operator|=
ObjCMethodInfo & operator|=(const ObjCContextInfo &RHS)
Definition: Types.h:611
clang::api_notes::EnumConstantInfo
Describes API notes data for an enumerator.
Definition: Types.h:648
clang::api_notes::ParamInfo::setNoEscape
void setNoEscape(llvm::Optional< bool > Value)
Definition: Types.h:431
clang::api_notes::SwiftNewTypeKind
SwiftNewTypeKind
The kind of a swift_wrapper/swift_newtype.
Definition: Types.h:38
clang::api_notes::FunctionInfo::RawRetainCountConvention
unsigned RawRetainCountConvention
A biased RetainCountConventionKind, where 0 means "unspecified".
Definition: Types.h:498
clang::api_notes::FunctionInfo::getReturnTypeInfo
NullabilityKind getReturnTypeInfo() const
Definition: Types.h:553
clang::api_notes::FunctionInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:72
clang::api_notes::VariableInfo::getType
const std::string & getType() const
Definition: Types.h:324
clang::api_notes::VariableInfo::setNullabilityAudited
void setNullabilityAudited(NullabilityKind kind)
Definition: Types.h:319
clang::api_notes::TagInfo::operator==
friend bool operator==(const TagInfo &, const TagInfo &)
Definition: Types.h:690
clang::api_notes::CommonEntityInfo::UnavailableMsg
std::string UnavailableMsg
Message to use when this entity is unavailable.
Definition: Types.h:50
clang::api_notes::ObjCContextInfo::getSwiftObjCMembers
llvm::Optional< bool > getSwiftObjCMembers() const
Definition: Types.h:245
clang::api_notes::FunctionInfo::addParamTypeInfo
void addParamTypeInfo(unsigned index, NullabilityKind kind)
Adds the parameter type info.
Definition: Types.h:545
clang::api_notes::ObjCPropertyInfo
Describes API notes data for an Objective-C property.
Definition: Types.h:354
clang::api_notes::CommonEntityInfo::operator|=
CommonEntityInfo & operator|=(const CommonEntityInfo &RHS)
Definition: Types.h:85
clang::api_notes::CommonEntityInfo::setSwiftPrivate
void setSwiftPrivate(llvm::Optional< bool > Private)
Definition: Types.h:78
clang::api_notes::FunctionInfo::setRetainCountConvention
void setRetainCountConvention(llvm::Optional< RetainCountConventionKind > Value)
Definition: Types.h:561
clang::api_notes::FunctionInfo::operator==
friend bool operator==(const FunctionInfo &, const FunctionInfo &)
Definition: Types.h:585
clang::api_notes::EnumConstantInfo::EnumConstantInfo
EnumConstantInfo()
Definition: Types.h:650
clang::api_notes::TagInfo::isFlagEnum
llvm::Optional< bool > isFlagEnum() const
Definition: Types.h:663
clang::api_notes::FunctionInfo::ResultType
std::string ResultType
The result type of this function, as a C type.
Definition: Types.h:508
clang::api_notes::ParamInfo::getRetainCountConvention
llvm::Optional< RetainCountConventionKind > getRetainCountConvention() const
Definition: Types.h:436
clang::api_notes::CommonEntityInfo::isSwiftPrivate
llvm::Optional< bool > isSwiftPrivate() const
Definition: Types.h:73
clang::api_notes::ParamInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:64
clang::api_notes::FunctionInfo::addReturnTypeInfo
void addReturnTypeInfo(NullabilityKind kind)
Adds the return type info.
Definition: Types.h:540
clang::api_notes::ObjCContextInfo::getDefaultNullability
llvm::Optional< NullabilityKind > getDefaultNullability() const
Determine the default nullability for properties and methods of this class.
Definition: Types.h:219
clang::api_notes::TypedefInfo::TypedefInfo
TypedefInfo()
Definition: Types.h:705
clang::api_notes::ParamInfo
Describes a function or method parameter.
Definition: Types.h:410
clang::api_notes::RetainCountConventionKind::NSReturnsNotRetained
@ NSReturnsNotRetained
clang::api_notes::CommonTypeInfo::operator==
friend bool operator==(const CommonTypeInfo &, const CommonTypeInfo &)
Definition: Types.h:182
clang::api_notes::TagInfo::operator|=
TagInfo & operator|=(const TagInfo &RHS)
Definition: Types.h:673
clang::api_notes::ObjCPropertyInfo::getSwiftImportAsAccessors
llvm::Optional< bool > getSwiftImportAsAccessors() const
Definition: Types.h:362
clang::api_notes::ObjCPropertyInfo::operator==
friend bool operator==(const ObjCPropertyInfo &, const ObjCPropertyInfo &)
Definition: Types.h:398
clang::api_notes::CommonTypeInfo::setSwiftBridge
void setSwiftBridge(const llvm::Optional< std::string > &SwiftType)
Definition: Types.h:142
clang::api_notes::ObjCPropertyInfo::operator|=
ObjCPropertyInfo & operator|=(const ObjCPropertyInfo &RHS)
Definition: Types.h:386
clang::api_notes::CommonTypeInfo::getNSErrorDomain
const llvm::Optional< std::string > & getNSErrorDomain() const
Definition: Types.h:152
clang::api_notes::ObjCContextInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS)
Definition: APINotesTypes.cpp:35
clang::api_notes::ObjCContextInfo::getSwiftImportAsNonGeneric
llvm::Optional< bool > getSwiftImportAsNonGeneric() const
Definition: Types.h:235
clang::api_notes::CommonTypeInfo::setNSErrorDomain
void setNSErrorDomain(const llvm::Optional< llvm::StringRef > &Domain)
Definition: Types.h:160
clang::api_notes::FunctionInfo::NumAdjustedNullable
unsigned NumAdjustedNullable
Number of types whose nullability is encoded with the NullabilityPayload.
Definition: Types.h:495
clang::api_notes::ObjCPropertyInfo::ObjCPropertyInfo
ObjCPropertyInfo()
Definition: Types.h:359
clang::api_notes::FunctionInfo::NullabilityAudited
unsigned NullabilityAudited
Whether the signature has been audited with respect to nullability.
Definition: Types.h:492
false
#define false
Definition: stdbool.h:22
clang::api_notes::CommonTypeInfo::operator|=
CommonTypeInfo & operator|=(const CommonTypeInfo &RHS)
Definition: Types.h:167
clang::api_notes::TypedefInfo::operator==
friend bool operator==(const TypedefInfo &, const TypedefInfo &)
Definition: Types.h:719
clang::api_notes::CommonEntityInfo::UnavailableInSwift
unsigned UnavailableInSwift
Whether this entity is marked unavailable in Swift.
Definition: Types.h:56
clang::api_notes::ParamInfo::operator|=
ParamInfo & operator|=(const ParamInfo &RHS)
Definition: Types.h:448
clang::api_notes::TagInfo::setFlagEnum
void setFlagEnum(llvm::Optional< bool > Value)
Definition: Types.h:668
clang::api_notes::ObjCMethodInfo::ObjCMethodInfo
ObjCMethodInfo()
Definition: Types.h:607
clang::api_notes::ObjCContextInfo
Describes API notes data for an Objective-C class or protocol.
Definition: Types.h:193
clang::api_notes::GlobalVariableInfo::GlobalVariableInfo
GlobalVariableInfo()
Definition: Types.h:638
Value
Value
Definition: UninitializedValues.cpp:102
clang::api_notes::CommonTypeInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:26
clang::api_notes::TagInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS)
Definition: APINotesTypes.cpp:90
clang::api_notes::TypedefInfo::operator|=
TypedefInfo & operator|=(const TypedefInfo &RHS)
Definition: Types.h:707
clang::api_notes::CommonTypeInfo::setSwiftBridge
void setSwiftBridge(const llvm::Optional< llvm::StringRef > &SwiftType)
Definition: Types.h:146
clang::api_notes::VariableInfo::operator|=
VariableInfo & operator|=(const VariableInfo &RHS)
Definition: Types.h:329
clang::api_notes::GlobalFunctionInfo::GlobalFunctionInfo
GlobalFunctionInfo()
Definition: Types.h:644
clang::api_notes::operator==
bool operator==(const CommonEntityInfo &LHS, const CommonEntityInfo &RHS)
Definition: Types.h:111
clang::api_notes::FunctionInfo::Params
std::vector< ParamInfo > Params
The function parameters.
Definition: Types.h:511
clang::api_notes::ObjCPropertyInfo::setSwiftImportAsAccessors
void setSwiftImportAsAccessors(llvm::Optional< bool > Value)
Definition: Types.h:367
clang::api_notes::ObjCMethodInfo::operator==
friend bool operator==(const ObjCMethodInfo &, const ObjCMethodInfo &)
Definition: Types.h:625
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::api_notes::SwiftNewTypeKind::Enum
@ Enum
clang::api_notes::ObjCPropertyInfo::operator|=
ObjCPropertyInfo & operator|=(const ObjCContextInfo &RHS)
Merge class-wide information into the given property.
Definition: Types.h:375
clang::api_notes::ParamInfo::isNoEscape
llvm::Optional< bool > isNoEscape() const
Definition: Types.h:426
clang::api_notes::VariableInfo::setType
void setType(const std::string &type)
Definition: Types.h:325
clang::NullabilityKind
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:316
clang::api_notes::ObjCContextInfo::ObjCContextInfo
ObjCContextInfo()
Definition: Types.h:210
clang::api_notes::FunctionInfo::NullabilityPayload
uint64_t NullabilityPayload
Stores the nullability of the return type and the parameters.
Definition: Types.h:505
clang
Definition: CalledOnceCheck.h:17
clang::api_notes::FunctionInfo::FunctionInfo
FunctionInfo()
Definition: Types.h:513
clang::api_notes::ObjCContextInfo::operator|=
ObjCContextInfo & operator|=(const ObjCContextInfo &RHS)
Definition: Types.h:263
clang::NullabilityKind::Nullable
@ Nullable
Values of this type can be null.
clang::api_notes::CommonTypeInfo
Describes API notes for types.
Definition: Types.h:126
clang::api_notes::CommonEntityInfo::SwiftName
std::string SwiftName
Swift name of this entity.
Definition: Types.h:67
clang::api_notes::RetainCountConventionKind::CFReturnsRetained
@ CFReturnsRetained
clang::api_notes::CommonEntityInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:14
clang::api_notes::EnumExtensibilityKind::None
@ None
clang::api_notes::FunctionInfo::getMaxNullabilityIndex
static unsigned getMaxNullabilityIndex()
Definition: Types.h:517
clang::api_notes::ObjCMethodInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS)
Definition: APINotesTypes.cpp:84
clang::api_notes::SwiftNewTypeKind::Struct
@ Struct
clang::NullabilityKind::NonNull
@ NonNull
Values of this type can never be null.
clang::api_notes::VariableInfo::getNullability
llvm::Optional< NullabilityKind > getNullability() const
Definition: Types.h:313
clang::api_notes::TypedefInfo::dump
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const
Definition: APINotesTypes.cpp:100
clang::api_notes::RetainCountConventionKind::None
@ None
clang::api_notes::FunctionInfo
API notes for a function or method.
Definition: Types.h:479
clang::diag::kind
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Definition: DiagnosticIDs.h:62
clang::api_notes::EnumExtensibilityKind::Open
@ Open
clang::api_notes::CommonEntityInfo::CommonEntityInfo
CommonEntityInfo()
Definition: Types.h:69
clang::api_notes::ObjCContextInfo::stripModuleLocalInfo
void stripModuleLocalInfo()
Strip off any information within the class information structure that is module-local,...
Definition: Types.h:256
clang::api_notes::operator!=
bool operator!=(const CommonEntityInfo &LHS, const CommonEntityInfo &RHS)
Definition: Types.h:120
clang::api_notes::ObjCContextInfo::setSwiftObjCMembers
void setSwiftObjCMembers(llvm::Optional< bool > Value)
Definition: Types.h:249
clang::api_notes::RetainCountConventionKind::CFReturnsNotRetained
@ CFReturnsNotRetained
clang::api_notes::VariableInfo::VariableInfo
VariableInfo()
Definition: Types.h:311