[clang] [APINotes][BoundsSafety] Upstream API notes format for bounds-safety function parameters (PR #186960)

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 09:41:09 PDT 2026


================
@@ -1074,14 +1071,45 @@ void APINotesWriter::Implementation::writeGlobalVariableBlock(
 }
 
 namespace {
+void emitBoundsSafetyInfo(raw_ostream &OS, const BoundsSafetyInfo &BSI) {
+  llvm::support::endian::Writer writer(OS, llvm::endianness::little);
+  uint8_t flags = 0;
+  if (auto kind = BSI.getKind()) {
+    assert((uint8_t)*kind < (1 << 3));
----------------
compnerd wrote:

I'm not sure I like the cast here - it would silently truncate the value.

https://github.com/llvm/llvm-project/pull/186960


More information about the cfe-commits mailing list