================
@@ -338,6 +338,78 @@ inline bool operator!=(const ContextInfo &LHS, const 
ContextInfo &RHS) {
   return !(LHS == RHS);
 }
 
+class BoundsSafetyInfo {
+public:
+  enum class BoundsSafetyKind {
+    CountedBy,
+    CountedByOrNull,
+    SizedBy,
+    SizedByOrNull,
+    EndedBy,
+  };
+
+private:
+  /// Whether the bounds safety kind has been audited.
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned KindAudited : 1;
+
+  /// The kind of bounds safety for this property. Only valid if the bounds
+  /// safety has been audited.
+  LLVM_PREFERRED_TYPE(BoundsSafetyKind)
+  unsigned Kind : 3;
+
+  /// Whether the pointer indirection level has been specified.
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned LevelAudited : 1;
+
+  /// The pointer indirection level at which the bounds annotation applies.
+  /// Only valid if LevelAudited is set.
+  unsigned Level : 3;
+
+public:
+  std::string ExternalBounds;
----------------
flash1729 wrote:

yes it is mutated during its lifetime in 
[APINotesYAMLCompiler.cpp(L830)](https://github.com/llvm/llvm-project/pull/186960/changes#diff-067b3c083e8e640b2d35ddac9d9ecb87d86b62894c6fdd979e4af47a12c6e93cR830)
 and 
[APINotesReader.cpp(L352)](https://github.com/llvm/llvm-project/pull/186960/changes#diff-ef2f0c808bebb362b62f4407f52c2e4fa14c7bb44e38eb901123a65a8614c4daR352)
 where a direct assignment happens 

As for semantics, `ExternalBounds` is not at all related to Kind or Level 
bitfields in any way, so changing this does not invalidate any state in the 
object.
Due to both of these things, I feel keeping this public and mutable is 
perfectly fine.

https://github.com/llvm/llvm-project/pull/186960
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to