clang  14.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 =
162  Domain ? llvm::Optional<std::string>(std::string(*Domain)) : llvm::None;
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  : CommonTypeInfo(), HasDefaultNullability(0), DefaultNullability(0),
212  HasDesignatedInits(0), SwiftImportAsNonGenericSpecified(false),
213  SwiftImportAsNonGeneric(false), SwiftObjCMembersSpecified(false),
214  SwiftObjCMembers(false) {}
215 
216  /// Determine the default nullability for properties and methods of this
217  /// class.
218  ///
219  /// eturns the default nullability, if implied, or None if there is no
221  return HasDefaultNullability
223  static_cast<NullabilityKind>(DefaultNullability))
224  : llvm::None;
225  }
226 
227  /// Set the default nullability for properties and methods of this class.
229  HasDefaultNullability = true;
230  DefaultNullability = static_cast<unsigned>(Kind);
231  }
232 
233  bool hasDesignatedInits() const { return HasDesignatedInits; }
234  void setHasDesignatedInits(bool Value) { HasDesignatedInits = Value; }
235 
237  return SwiftImportAsNonGenericSpecified
238  ? llvm::Optional<bool>(SwiftImportAsNonGeneric)
239  : llvm::None;
240  }
242  SwiftImportAsNonGenericSpecified = Value.hasValue();
243  SwiftImportAsNonGeneric = Value.hasValue() ? *Value : false;
244  }
245 
247  return SwiftObjCMembersSpecified ? llvm::Optional<bool>(SwiftObjCMembers)
248  : llvm::None;
249  }
251  SwiftObjCMembersSpecified = Value.hasValue();
252  SwiftObjCMembers = Value.hasValue() ? *Value : false;
253  }
254 
255  /// Strip off any information within the class information structure that is
256  /// module-local, such as 'audited' flags.
258  HasDefaultNullability = false;
259  DefaultNullability = 0;
260  }
261 
262  friend bool operator==(const ObjCContextInfo &, const ObjCContextInfo &);
263 
265  // Merge inherited info.
266  static_cast<CommonTypeInfo &>(*this) |= RHS;
267 
268  // Merge nullability.
269  if (!getDefaultNullability())
270  if (auto Nullability = RHS.getDefaultNullability())
272 
273  if (!SwiftImportAsNonGenericSpecified)
275 
276  if (!SwiftObjCMembersSpecified)
278 
279  HasDesignatedInits |= RHS.HasDesignatedInits;
280 
281  return *this;
282  }
283 
284  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
285 };
286 
287 inline bool operator==(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) {
288  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
290  LHS.HasDesignatedInits == RHS.HasDesignatedInits &&
293 }
294 
295 inline bool operator!=(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) {
296  return !(LHS == RHS);
297 }
298 
299 /// API notes for a variable/property.
301  /// Whether this property has been audited for nullability.
302  unsigned NullabilityAudited : 1;
303 
304  /// The kind of nullability for this property. Only valid if the nullability
305  /// has been audited.
306  unsigned Nullable : 2;
307 
308  /// The C type of the variable, as a string.
310 
311 public:
312  VariableInfo() : CommonEntityInfo(), NullabilityAudited(false), Nullable(0) {}
313 
315  return NullabilityAudited ? llvm::Optional<NullabilityKind>(
316  static_cast<NullabilityKind>(Nullable))
317  : llvm::None;
318  }
319 
321  NullabilityAudited = true;
322  Nullable = static_cast<unsigned>(kind);
323  }
324 
325  const std::string &getType() const { return Type; }
326  void setType(const std::string &type) { Type = type; }
327 
328  friend bool operator==(const VariableInfo &, const VariableInfo &);
329 
331  static_cast<CommonEntityInfo &>(*this) |= RHS;
332 
333  if (!NullabilityAudited && RHS.NullabilityAudited)
335  if (Type.empty())
336  Type = RHS.Type;
337 
338  return *this;
339  }
340 
341  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
342 };
343 
344 inline bool operator==(const VariableInfo &LHS, const VariableInfo &RHS) {
345  return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
346  LHS.NullabilityAudited == RHS.NullabilityAudited &&
347  LHS.Nullable == RHS.Nullable && LHS.Type == RHS.Type;
348 }
349 
350 inline bool operator!=(const VariableInfo &LHS, const VariableInfo &RHS) {
351  return !(LHS == RHS);
352 }
353 
354 /// Describes API notes data for an Objective-C property.
356  unsigned SwiftImportAsAccessorsSpecified : 1;
357  unsigned SwiftImportAsAccessors : 1;
358 
359 public:
361  : VariableInfo(), SwiftImportAsAccessorsSpecified(false),
362  SwiftImportAsAccessors(false) {}
363 
365  return SwiftImportAsAccessorsSpecified
366  ? llvm::Optional<bool>(SwiftImportAsAccessors)
367  : llvm::None;
368  }
370  SwiftImportAsAccessorsSpecified = Value.hasValue();
371  SwiftImportAsAccessors = Value.hasValue() ? *Value : false;
372  }
373 
374  friend bool operator==(const ObjCPropertyInfo &, const ObjCPropertyInfo &);
375 
376  /// Merge class-wide information into the given property.
378  static_cast<CommonEntityInfo &>(*this) |= RHS;
379 
380  // Merge nullability.
381  if (!getNullability())
382  if (auto Nullable = RHS.getDefaultNullability())
384 
385  return *this;
386  }
387 
389  static_cast<VariableInfo &>(*this) |= RHS;
390 
391  if (!SwiftImportAsAccessorsSpecified)
393 
394  return *this;
395  }
396 
397  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
398 };
399 
400 inline bool operator==(const ObjCPropertyInfo &LHS,
401  const ObjCPropertyInfo &RHS) {
402  return static_cast<const VariableInfo &>(LHS) == RHS &&
404 }
405 
406 inline bool operator!=(const ObjCPropertyInfo &LHS,
407  const ObjCPropertyInfo &RHS) {
408  return !(LHS == RHS);
409 }
410 
411 /// Describes a function or method parameter.
412 class ParamInfo : public VariableInfo {
413  /// Whether noescape was specified.
414  unsigned NoEscapeSpecified : 1;
415 
416  /// Whether the this parameter has the 'noescape' attribute.
417  unsigned NoEscape : 1;
418 
419  /// A biased RetainCountConventionKind, where 0 means "unspecified".
420  ///
421  /// Only relevant for out-parameters.
422  unsigned RawRetainCountConvention : 3;
423 
424 public:
426  : VariableInfo(), NoEscapeSpecified(false), NoEscape(false),
427  RawRetainCountConvention() {}
428 
430  if (!NoEscapeSpecified)
431  return llvm::None;
432  return NoEscape;
433  }
435  NoEscapeSpecified = Value.hasValue();
436  NoEscape = Value.hasValue() ? *Value : false;
437  }
438 
440  if (!RawRetainCountConvention)
441  return llvm::None;
442  return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
443  }
444  void
446  RawRetainCountConvention =
447  Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
448  assert(getRetainCountConvention() == Value && "bitfield too small");
449  }
450 
452  static_cast<VariableInfo &>(*this) |= RHS;
453 
454  if (!NoEscapeSpecified && RHS.NoEscapeSpecified) {
455  NoEscapeSpecified = true;
456  NoEscape = RHS.NoEscape;
457  }
458 
459  if (!RawRetainCountConvention)
460  RawRetainCountConvention = RHS.RawRetainCountConvention;
461 
462  return *this;
463  }
464 
465  friend bool operator==(const ParamInfo &, const ParamInfo &);
466 
467  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
468 };
469 
470 inline bool operator==(const ParamInfo &LHS, const ParamInfo &RHS) {
471  return static_cast<const VariableInfo &>(LHS) == RHS &&
472  LHS.NoEscapeSpecified == RHS.NoEscapeSpecified &&
473  LHS.NoEscape == RHS.NoEscape &&
474  LHS.RawRetainCountConvention == RHS.RawRetainCountConvention;
475 }
476 
477 inline bool operator!=(const ParamInfo &LHS, const ParamInfo &RHS) {
478  return !(LHS == RHS);
479 }
480 
481 /// API notes for a function or method.
483 private:
484  static constexpr const unsigned NullabilityKindMask = 0x3;
485  static constexpr const unsigned NullabilityKindSize = 2;
486 
487  static constexpr const unsigned ReturnInfoIndex = 0;
488 
489 public:
490  // If yes, we consider all types to be non-nullable unless otherwise noted.
491  // If this flag is not set, the pointer types are considered to have
492  // unknown nullability.
493 
494  /// Whether the signature has been audited with respect to nullability.
495  unsigned NullabilityAudited : 1;
496 
497  /// Number of types whose nullability is encoded with the NullabilityPayload.
498  unsigned NumAdjustedNullable : 8;
499 
500  /// A biased RetainCountConventionKind, where 0 means "unspecified".
502 
503  // NullabilityKindSize bits are used to encode the nullability. The info
504  // about the return type is stored at position 0, followed by the nullability
505  // of the parameters.
506 
507  /// Stores the nullability of the return type and the parameters.
508  uint64_t NullabilityPayload = 0;
509 
510  /// The result type of this function, as a C type.
512 
513  /// The function parameters.
514  std::vector<ParamInfo> Params;
515 
519 
520  static unsigned getMaxNullabilityIndex() {
521  return ((sizeof(NullabilityPayload) * CHAR_BIT) / NullabilityKindSize);
522  }
523 
524  void addTypeInfo(unsigned index, NullabilityKind kind) {
525  assert(index <= getMaxNullabilityIndex());
526  assert(static_cast<unsigned>(kind) < NullabilityKindMask);
527 
528  NullabilityAudited = true;
529  if (NumAdjustedNullable < index + 1)
530  NumAdjustedNullable = index + 1;
531 
532  // Mask the bits.
534  ~(NullabilityKindMask << (index * NullabilityKindSize));
535 
536  // Set the value.
537  unsigned kindValue = (static_cast<unsigned>(kind))
538  << (index * NullabilityKindSize);
539  NullabilityPayload |= kindValue;
540  }
541 
542  /// Adds the return type info.
544  addTypeInfo(ReturnInfoIndex, kind);
545  }
546 
547  /// Adds the parameter type info.
548  void addParamTypeInfo(unsigned index, NullabilityKind kind) {
549  addTypeInfo(index + 1, kind);
550  }
551 
552  NullabilityKind getParamTypeInfo(unsigned index) const {
553  return getTypeInfo(index + 1);
554  }
555 
556  NullabilityKind getReturnTypeInfo() const { return getTypeInfo(0); }
557 
560  return llvm::None;
561  return static_cast<RetainCountConventionKind>(RawRetainCountConvention - 1);
562  }
563  void
566  Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
567  assert(getRetainCountConvention() == Value && "bitfield too small");
568  }
569 
570  friend bool operator==(const FunctionInfo &, const FunctionInfo &);
571 
572 private:
573  NullabilityKind getTypeInfo(unsigned index) const {
574  assert(NullabilityAudited &&
575  "Checking the type adjustment on non-audited method.");
576 
577  // If we don't have info about this parameter, return the default.
578  if (index > NumAdjustedNullable)
580  auto nullability = NullabilityPayload >> (index * NullabilityKindSize);
581  return static_cast<NullabilityKind>(nullability & NullabilityKindMask);
582  }
583 
584 public:
585  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
586 };
587 
588 inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
589  return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
593  LHS.ResultType == RHS.ResultType && LHS.Params == RHS.Params &&
595 }
596 
597 inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {
598  return !(LHS == RHS);
599 }
600 
601 /// Describes API notes data for an Objective-C method.
602 class ObjCMethodInfo : public FunctionInfo {
603 public:
604  /// Whether this is a designated initializer of its class.
605  unsigned DesignatedInit : 1;
606 
607  /// Whether this is a required initializer.
608  unsigned RequiredInit : 1;
609 
612 
613  friend bool operator==(const ObjCMethodInfo &, const ObjCMethodInfo &);
614 
616  // Merge Nullability.
617  if (!NullabilityAudited) {
618  if (auto Nullable = RHS.getDefaultNullability()) {
619  NullabilityAudited = true;
620  addTypeInfo(0, *Nullable);
621  }
622  }
623  return *this;
624  }
625 
626  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
627 };
628 
629 inline bool operator==(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) {
630  return static_cast<const FunctionInfo &>(LHS) == RHS &&
631  LHS.DesignatedInit == RHS.DesignatedInit &&
632  LHS.RequiredInit == RHS.RequiredInit;
633 }
634 
635 inline bool operator!=(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) {
636  return !(LHS == RHS);
637 }
638 
639 /// Describes API notes data for a global variable.
641 public:
643 };
644 
645 /// Describes API notes data for a global function.
647 public:
649 };
650 
651 /// Describes API notes data for an enumerator.
653 public:
655 };
656 
657 /// Describes API notes data for a tag.
658 class TagInfo : public CommonTypeInfo {
659  unsigned HasFlagEnum : 1;
660  unsigned IsFlagEnum : 1;
661 
662 public:
664 
665  TagInfo() : CommonTypeInfo(), HasFlagEnum(0), IsFlagEnum(0) {}
666 
668  if (HasFlagEnum)
669  return IsFlagEnum;
670  return llvm::None;
671  }
673  HasFlagEnum = Value.hasValue();
674  IsFlagEnum = Value.hasValue() ? *Value : false;
675  }
676 
677  TagInfo &operator|=(const TagInfo &RHS) {
678  static_cast<CommonTypeInfo &>(*this) |= RHS;
679 
680  if (!HasFlagEnum && HasFlagEnum)
681  setFlagEnum(RHS.isFlagEnum());
682 
683  if (!EnumExtensibility.hasValue())
685 
686  return *this;
687  }
688 
689  friend bool operator==(const TagInfo &, const TagInfo &);
690 
691  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
692 };
693 
694 inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) {
695  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
696  LHS.isFlagEnum() == RHS.isFlagEnum() &&
698 }
699 
700 inline bool operator!=(const TagInfo &LHS, const TagInfo &RHS) {
701  return !(LHS == RHS);
702 }
703 
704 /// Describes API notes data for a typedef.
705 class TypedefInfo : public CommonTypeInfo {
706 public:
708 
710 
712  static_cast<CommonTypeInfo &>(*this) |= RHS;
713  if (!SwiftWrapper.hasValue())
715  return *this;
716  }
717 
718  friend bool operator==(const TypedefInfo &, const TypedefInfo &);
719 
720  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
721 };
722 
723 inline bool operator==(const TypedefInfo &LHS, const TypedefInfo &RHS) {
724  return static_cast<const CommonTypeInfo &>(LHS) == RHS &&
725  LHS.SwiftWrapper == RHS.SwiftWrapper;
726 }
727 
728 inline bool operator!=(const TypedefInfo &LHS, const TypedefInfo &RHS) {
729  return !(LHS == RHS);
730 }
731 } // namespace api_notes
732 } // namespace clang
733 
734 #endif
clang::api_notes::GlobalFunctionInfo
Describes API notes data for a global function.
Definition: Types.h:646
clang::api_notes::TagInfo
Describes API notes data for a tag.
Definition: Types.h:658
clang::api_notes::ObjCMethodInfo::RequiredInit
unsigned RequiredInit
Whether this is a required initializer.
Definition: Types.h:608
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:445
clang::api_notes::TypedefInfo
Describes API notes data for a typedef.
Definition: Types.h:705
clang::api_notes::VariableInfo::operator==
friend bool operator==(const VariableInfo &, const VariableInfo &)
Definition: Types.h:344
clang::api_notes::FunctionInfo::getParamTypeInfo
NullabilityKind getParamTypeInfo(unsigned index) const
Definition: Types.h:552
clang::ento::Nullability
Nullability
Definition: CheckerHelpers.h:56
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:287
clang::api_notes::SwiftNewTypeKind::None
@ None
clang::api_notes::FunctionInfo::getRetainCountConvention
llvm::Optional< RetainCountConventionKind > getRetainCountConvention() const
Definition: Types.h:558
clang::api_notes::TypedefInfo::SwiftWrapper
llvm::Optional< SwiftNewTypeKind > SwiftWrapper
Definition: Types.h:707
clang::api_notes::FunctionInfo::addTypeInfo
void addTypeInfo(unsigned index, NullabilityKind kind)
Definition: Types.h:524
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:228
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:425
clang::api_notes::ObjCContextInfo::setHasDesignatedInits
void setHasDesignatedInits(bool Value)
Definition: Types.h:234
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:640
clang::api_notes::ObjCContextInfo::hasDesignatedInits
bool hasDesignatedInits() const
Definition: Types.h:233
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:663
clang::api_notes::VariableInfo
API notes for a variable/property.
Definition: Types.h:300
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:470
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:1490
clang::api_notes::ObjCContextInfo::setSwiftImportAsNonGeneric
void setSwiftImportAsNonGeneric(llvm::Optional< bool > Value)
Definition: Types.h:241
clang::api_notes::TagInfo::TagInfo
TagInfo()
Definition: Types.h:665
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:605
clang::api_notes::ObjCMethodInfo
Describes API notes data for an Objective-C method.
Definition: Types.h:602
clang::api_notes::ObjCMethodInfo::operator|=
ObjCMethodInfo & operator|=(const ObjCContextInfo &RHS)
Definition: Types.h:615
clang::api_notes::EnumConstantInfo
Describes API notes data for an enumerator.
Definition: Types.h:652
clang::api_notes::ParamInfo::setNoEscape
void setNoEscape(llvm::Optional< bool > Value)
Definition: Types.h:434
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:501
clang::api_notes::FunctionInfo::getReturnTypeInfo
NullabilityKind getReturnTypeInfo() const
Definition: Types.h:556
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:325
clang::api_notes::VariableInfo::setNullabilityAudited
void setNullabilityAudited(NullabilityKind kind)
Definition: Types.h:320
clang::api_notes::TagInfo::operator==
friend bool operator==(const TagInfo &, const TagInfo &)
Definition: Types.h:694
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:246
clang::api_notes::FunctionInfo::addParamTypeInfo
void addParamTypeInfo(unsigned index, NullabilityKind kind)
Adds the parameter type info.
Definition: Types.h:548
clang::api_notes::ObjCPropertyInfo
Describes API notes data for an Objective-C property.
Definition: Types.h:355
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:564
clang::api_notes::FunctionInfo::operator==
friend bool operator==(const FunctionInfo &, const FunctionInfo &)
Definition: Types.h:588
clang::api_notes::EnumConstantInfo::EnumConstantInfo
EnumConstantInfo()
Definition: Types.h:654
clang::api_notes::TagInfo::isFlagEnum
llvm::Optional< bool > isFlagEnum() const
Definition: Types.h:667
clang::api_notes::FunctionInfo::ResultType
std::string ResultType
The result type of this function, as a C type.
Definition: Types.h:511
clang::api_notes::ParamInfo::getRetainCountConvention
llvm::Optional< RetainCountConventionKind > getRetainCountConvention() const
Definition: Types.h:439
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:543
clang::api_notes::ObjCContextInfo::getDefaultNullability
llvm::Optional< NullabilityKind > getDefaultNullability() const
Determine the default nullability for properties and methods of this class.
Definition: Types.h:220
clang::api_notes::TypedefInfo::TypedefInfo
TypedefInfo()
Definition: Types.h:709
clang::api_notes::ParamInfo
Describes a function or method parameter.
Definition: Types.h:412
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:677
clang::api_notes::ObjCPropertyInfo::getSwiftImportAsAccessors
llvm::Optional< bool > getSwiftImportAsAccessors() const
Definition: Types.h:364
clang::api_notes::ObjCPropertyInfo::operator==
friend bool operator==(const ObjCPropertyInfo &, const ObjCPropertyInfo &)
Definition: Types.h:400
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:388
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:236
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:498
clang::api_notes::ObjCPropertyInfo::ObjCPropertyInfo
ObjCPropertyInfo()
Definition: Types.h:360
clang::api_notes::FunctionInfo::NullabilityAudited
unsigned NullabilityAudited
Whether the signature has been audited with respect to nullability.
Definition: Types.h:495
false
#define false
Definition: stdbool.h:17
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:723
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:451
clang::api_notes::TagInfo::setFlagEnum
void setFlagEnum(llvm::Optional< bool > Value)
Definition: Types.h:672
clang::api_notes::ObjCMethodInfo::ObjCMethodInfo
ObjCMethodInfo()
Definition: Types.h:610
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:642
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:711
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:330
clang::api_notes::GlobalFunctionInfo::GlobalFunctionInfo
GlobalFunctionInfo()
Definition: Types.h:648
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:514
clang::api_notes::ObjCPropertyInfo::setSwiftImportAsAccessors
void setSwiftImportAsAccessors(llvm::Optional< bool > Value)
Definition: Types.h:369
clang::api_notes::ObjCMethodInfo::operator==
friend bool operator==(const ObjCMethodInfo &, const ObjCMethodInfo &)
Definition: Types.h:629
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:377
clang::api_notes::ParamInfo::isNoEscape
llvm::Optional< bool > isNoEscape() const
Definition: Types.h:429
clang::api_notes::VariableInfo::setType
void setType(const std::string &type)
Definition: Types.h:326
clang::NullabilityKind
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:315
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:508
clang
Definition: CalledOnceCheck.h:17
clang::api_notes::FunctionInfo::FunctionInfo
FunctionInfo()
Definition: Types.h:516
clang::api_notes::ObjCContextInfo::operator|=
ObjCContextInfo & operator|=(const ObjCContextInfo &RHS)
Definition: Types.h:264
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:520
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:314
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:482
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:257
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:250
clang::api_notes::RetainCountConventionKind::CFReturnsNotRetained
@ CFReturnsNotRetained
clang::api_notes::VariableInfo::VariableInfo
VariableInfo()
Definition: Types.h:312