[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
bwendling wrote: @rapidsna My recent commits try to address a lot of the issues you brought up. If the FAM's array index is negative or out of bounds, it should now catch it and return an appropriate value. There may still be some corner cases that have to be hammered out, but I'd like to get

[clang-tools-extra] [llvm] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Yeoul Na via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Yeoul Na via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang-tools-extra] [llvm] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Yeoul Na via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Yeoul Na via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Yeoul Na via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-03 Thread Bill Wendling via cfe-commits
bwendling wrote: > I just wanted to call out that this case is interesting because the size > derived from malloc and __counted_by compete each other. And __counted_by > always wins. This conforms to how -fbounds-safety will see the size of > objects, so sounds like we are all happy with it.

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-03 Thread Yeoul Na via cfe-commits
rapidsna wrote: > With this PR I get: > > ``` > $ clang -O2 ~/llvm/bdos.c > $ ./a.out > 400 > 400 > 404 > ``` Oh I see. > I think the first two `printf` s in your code seem correct with 40, because > they're both looking at only the FAM, not the entire struct. Interesting. So this sounds

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-03 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,65 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +const Expr *

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-03 Thread Bill Wendling via cfe-commits
bwendling wrote: > ``` > #include > #include > struct flex { > int c; > int fam[] __attribute__((counted_by(c))); > }; > > int main() { > struct flex *p = (struct flex *)malloc(sizeof(struct flex) + sizeof(int) > * 10); > p->c = 100; > printf("%lu\n",

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-02 Thread Shafik Yaghmour via cfe-commits
@@ -966,9 +962,65 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +const Expr *

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-02 Thread Shafik Yaghmour via cfe-commits
@@ -966,9 +962,65 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +const Expr *

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-02 Thread Yeoul Na via cfe-commits
rapidsna wrote: ``` #include #include struct flex { int c; int fam[] __attribute__((counted_by(c))); }; int main() { struct flex *p = (struct flex *)malloc(sizeof(struct flex) + sizeof(int) * 10); p->c = 100; printf("%lu\n", __builtin_dynamic_object_size(>fam[0], 0)); //

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-02 Thread Yeoul Na via cfe-commits
rapidsna wrote: > @kees, @nickdesaulniers, @rapidsna, and @apple-fcloutier Should this feature > support a `__bdos` to an address inside the FAM? > > ``` > #include > #include > > struct flex { > double dummy; > char count; > char fam[]

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-01 Thread Bill Wendling via cfe-commits
bwendling wrote: @kees, @nickdesaulniers, @rapidsna, and @apple-fcloutier Should this feature support a `__bdos` to an address inside the FAM? ``` #include #include struct flex { double dummy; char count; char fam[] __attribute__((counted_by(count))); }; int main()

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-01 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 01/13] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-01 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 01/12] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 01/11] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 01/10] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread via cfe-commits
https://github.com/apple-fcloutier edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/9] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/8] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/7] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/5] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Nick Desaulniers via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base =

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Nick Desaulniers via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Nick Desaulniers via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Nick Desaulniers via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Nick Desaulniers via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/4] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/3] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/2] [CodeGen] Revamp counted_by calculations Break down the

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 91b9a661c21891dc06e1721a26478d5bfe53e4ed 19dd7db8ab5f98a618c717944c96b34e604fbc30 --

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
bwendling wrote: To answer @nickdesaulniers 's question, the testcases are in the works. :-) https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Bill Wendling (bwendling) Changes Break down the counted_by calculations so that they correctly handle anonymous structs, which are specified internally as IndirectFieldDecls. Also simplify the code to use helper methods to get the field

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/70606 Break down the counted_by calculations so that they correctly handle anonymous structs, which are specified internally as IndirectFieldDecls. Also simplify the code to use helper methods to get the field