[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 11:40:02 PDT 2023


nickdesaulniers added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:857
+  if (IsDynamic) {
+    const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
+        getLangOpts().getStrictFlexArraysLevel();
----------------
aaron.ballman wrote:
> nickdesaulniers wrote:
> > aaron.ballman wrote:
> > > We don't generally use top-level const on local variables.
> > Do we explicitly document this in the style guide? This came up for me recently in a code review (cc @jyknight ).
> > https://llvm.org/docs/CodingStandards.html
> It's the prevailing style in our files rather than a hard rule. In Clang, we seem to have organically landed on "const members are fine, const locals are not fine, do not use globals". Our const-correctness story is terrible and if we had better const correct interfaces, I think we'd have landed somewhere different.
prevailing styles should be documented explicitly in the style guide. That settles all discussions, now and in the future.

Or perhaps an RFC on discourse.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148381/new/

https://reviews.llvm.org/D148381



More information about the cfe-commits mailing list