[clang] Reland #90786 ([BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C) (PR #93121)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 11:54:30 PDT 2024


================
@@ -4944,6 +4944,26 @@ void Parser::ParseStructDeclaration(
   }
 }
 
+// TODO: All callers of this function should be moved to
+// `Parser::ParseLexedAttributeList`.
+void Parser::ParseLexedCAttributeList(LateParsedAttrList &LAs, bool EnterScope,
+                                      ParsedAttributes *OutAttrs) {
+  assert(LAs.parseSoon() &&
+         "Attribute list should be marked for immediate parsing.");
+#ifndef NDEBUG
+  auto LangStd = getLangOpts().LangStd;
+  if (LangStd != LangStandard::lang_unspecified) {
+    auto Lang = LangStandard::getLangStandardForKind(LangStd).getLanguage();
+    assert(Lang == Language::C || Lang == Language::OpenCL);
----------------
delcypher wrote:

That doesn't sound equivalent. The language could also be objective-C or objective-C++.

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


More information about the cfe-commits mailing list