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 co
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 co
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
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
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
}
if (IsDynamic) {
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
-getLangOpts().getStrictFlexArraysLevel();
-const Expr *Base = E->IgnoreParenImpCa
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
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
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
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() {
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", __builtin_dynamic_obj
@@ -966,9 +962,65 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-FieldDecl *CodeGenFunction::FindCountedByField(
-const Expr *Base,
-LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) {
+const Expr *
+CodeGenFunction
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.
@@ -956,60 +951,199 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction &CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
+namespace {
+
+/// \
@@ -956,60 +951,199 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction &CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
+namespace {
+
+/// \
@@ -956,60 +951,199 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction &CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
+namespace {
+
+/// \
@@ -876,31 +876,26 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr
*E, unsigned Type,
}
// Get the flexible array member Decl.
- const ValueDecl *FAMDecl = nullptr;
+ const RecordDecl *OuterRD = nullptr;
if (const auto *ME = dyn_cast(Base)) {
// Check
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -956,60 +951,199 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction &CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
+namespace {
+
+/// \
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
bwendling wrote:
@efriedma-quic, @nickdesaulniers, @rapidsna:
This is the latest version of this patch. I believe it's ready to submit. I
_really_ tried to implement @efriedma-quic's idea, but there were too corner
cases that made it much trickier than first imagined. I know that it's not
imp
@@ -4073,6 +4221,51 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitLValue(Array);
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOpts.has(SanitizerKind::ArrayBounds)) {
+ // If the array being accessed h
@@ -4073,6 +4221,51 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitLValue(Array);
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOpts.has(SanitizerKind::ArrayBounds)) {
+ // If the array being accessed h
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
else
ArrayLV = EmitLValue(Array);
+
auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+if (SanOp
bwendling wrote:
> I don't mean for this next bit to sound as aggressive or irritated as it
> might but #73168 has been open for almost a month now and it is actively
> preventing us from testing the Linux kernel against tip of tree LLVM because
> (for better or worse...) the kernel has starte
@@ -740,3 +1058,589 @@ void test10(struct union_of_fams *p, int index) {
void test11(struct annotated *p, int index) {
p->array[index] = __builtin_dynamic_object_size(&p->count, 1);
}
+
+// SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test11_bdos(
+// SANITIZE-WITH-ATTR-SA
bwendling wrote:
> > > Can we please come to some consensus so that issue can be resolved?
> >
> >
> > This supposed bug fix snowballed out of control. I'd be happy to revert to
> > a previous version and then submit the newer work as a improvements.
>
> Linux kernel builds have been broken s
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/75857
There are many issues that popped up with the counted_by feature. The patch has
grown too large and approval is blocking Linux testing.
Includes reverts of:
commit 769bc11f684d ("[Clang] Implement the 'counted
bwendling wrote:
Here's a revert of the feature.
https://github.com/llvm/llvm-project/pull/75857
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cf
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/75857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/75857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl
*FD) {
}
}
+ // We don't support 'counted_by' on flexible array members in substructures.
+ const DeclContext *DC = FD->getParent();
+ while (const auto *RD = dyn_cast(DC)) {
+if (!RD-
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl
*FD) {
}
}
+ // We don't support 'counted_by' on flexible array members in substructures.
+ const DeclContext *DC = FD->getParent();
+ while (const auto *RD = dyn_cast(DC)) {
+if (!RD-
@@ -3946,6 +4080,32 @@ static Address emitArraySubscriptGEP(CodeGenFunction
&CGF, Address addr,
return Address(eltPtr, CGF.ConvertTypeForMem(eltType), eltAlign);
}
+static bool GetFieldOffsetInBits(CodeGenFunction &CGF, const RecordDecl *RD,
+
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl
*FD) {
}
}
+ // We don't support 'counted_by' on flexible array members in substructures.
+ const DeclContext *DC = FD->getParent();
+ while (const auto *RD = dyn_cast(DC)) {
+if (!RD-
@@ -3946,6 +4080,32 @@ static Address emitArraySubscriptGEP(CodeGenFunction
&CGF, Address addr,
return Address(eltPtr, CGF.ConvertTypeForMem(eltType), eltAlign);
}
+static bool GetFieldOffsetInBits(CodeGenFunction &CGF, const RecordDecl *RD,
+
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/75857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
https://github.com/llvm/llvm-project/pull/75857 has been merged in. This PR is
no longer valid.
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mai
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
> > #75857 has been merged in. This PR is no longer valid.
>
> Couldn't you just rebase it like:
>
> * base: `main`
> * pick revert of [Revert counted_by attribute featureĀ
> #75857](https://github.com/llvm/llvm-project/pull/75857)
> * all the commits of this PR
>
> It's a bit
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/73465
I'll add some testcases later today.
>From 3aa35a39184ff8d4ff11b9f41b4551bec78bdca5 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 22 Nov 2023 15:16:19 -0800
Subject: [PATCH] [Clang] Use correct base
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73465
>From 3aa35a39184ff8d4ff11b9f41b4551bec78bdca5 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 22 Nov 2023 15:16:19 -0800
Subject: [PATCH 1/2] [Clang] Use correct base expression for counted_by field
T
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E,
unsigned Type,
// Build a load of the counted_by field.
bool IsSigned = CountedByFD->getType()->isSignedIntegerType();
- const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)
@@ -956,37 +956,55 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
+Expr *CodeGenFunction
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E,
unsigned Type,
// Build a load of the counted_by field.
bool IsSigned = CountedByFD->getType()->isSignedIntegerType();
- const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E,
unsigned Type,
// Build a load of the counted_by field.
bool IsSigned = CountedByFD->getType()->isSignedIntegerType();
- const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73465
>From 3aa35a39184ff8d4ff11b9f41b4551bec78bdca5 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 22 Nov 2023 15:16:19 -0800
Subject: [PATCH 1/4] [Clang] Use correct base expression for counted_by field
T
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/73730
This is an alternative to https://github.com/llvm/llvm-project/pull/73465. It
generates the GEP directly. It's not tested well, but it might be a nicer
solution rather than adding AST nodes.
PTAL
>From 3e500
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/2] [Clang] Generate the GEP instead of adding AST nodes
---
@@ -956,42 +956,70 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
@@ -956,42 +956,70 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
@@ -956,42 +956,70 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
bwendling wrote:
> Hey, that looks pretty good! I'm surprised it wasn't too much more work to
> convert to generating the GEP directly. Nice job!
>
> Does this change result in codegen differences in IR? (was expecting test
> changes that used "fork" loads and "bork" GEPs)
Thanks. There will
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/3] [Clang] Generate the GEP instead of adding AST nodes
---
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/4] [Clang] Generate the GEP instead of adding AST nodes
---
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
bwendling wrote:
@AaronBallman It's not letting me comment on your comment. While a compound
literal doesn't have a DRE, it's also not a flexible array, so it's not
supposed to get this far.
https://github.com/llvm/llvm-project/pull/73730
___
cfe-com
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/5] [Clang] Generate the GEP instead of adding AST nodes
---
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/6] [Clang] Generate the GEP instead of adding AST nodes
---
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
bwendling wrote:
> > @AaronBallman It's not letting me comment on your comment. While a compound
> > literal doesn't have a DRE, it's also not a flexible array, so it's not
> > supposed to get this far. Note that this method should only be executed if
> > the flexible array member exists and h
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/73730
>From 3e500c2a7c6b7895ebe292a1ed50e04409ba149c Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 28 Nov 2023 17:17:54 -0800
Subject: [PATCH 1/7] [Clang] Generate the GEP instead of adding AST nodes
---
@@ -956,42 +956,70 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction
&CGF,
return nullptr;
}
-const Expr *
+namespace {
+
+struct MemberExprBaseVisitor
+: public StmtVisitor {
+ MemberExprBaseVisitor() = default;
+
+
//===--
bwendling wrote:
This should be ready for a final review now.
https://github.com/llvm/llvm-project/pull/73730
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/73465
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Closing in favor of https://github.com/llvm/llvm-project/pull/73730.
https://github.com/llvm/llvm-project/pull/73465
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
> CodeGenFunction::FindCountedByField finds a field with a corresponding base
> expression. Currently, it throws away the base expression. And the code
> you've just written tries to recompute the base. Instead of doing this dance,
> can we just make CodeGenFunction::FindCount
bwendling wrote:
> I'd like to see a few tests involving multiple arrows in the same expression.
> (If my understanding is correct, you want to cut the recursion when you see
> an arrow member.)
Correct. I'll add the code and some testcases.
> Looking at the code again, I guess FindCountedByF
bwendling wrote:
> I agree users probably shouldn't be doing that... but given it compiles your
> code should handle it gracefully. (It should just be a matter of making sure
> you don't recurse too deeply through the "base".)
*nods* However, the code it generates might not be what they want..
bwendling wrote:
Okay. With the latest commit, I handle some of the weird accesses. As it turns
out, looking at `isArrow()` for a `MemberExpr` isn't going to work, because
it'll happen with ordinary accesses:
```
ImplicitCastExpr 0x564fa8c3fd48 'int *'
`-MemberExpr 0x564fa8c3fcf8 'int[]' lval
bwendling wrote:
This is a PITA. There are two situations:
1. The expression was processed before getting to the `EmitBoundsCheck` call,
and is thus recorded in the `LocalDeclMap` for easy access. Grand!
2. Using a FAM in a `__builtin_dynamic_object_size` cannot have side effects.
Also, it may
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/76348
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Some (hopefully) helpful comments on this admittedly very large patch.
General Comment:
I pulled back on allowing the `count` to be in a non-anonymous struct that
doesn't contain the flexible array. So this is no longer allowed:
```
struct count_not_in_substruct {
unsigned
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/76882
>From ca7a96a40952fe94b916dacc52f07aa90bbdb1e7 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 3 Jan 2024 13:22:37 -0800
Subject: [PATCH 1/3] [builtin_object_size] Use classes instead of std::pair
(NFC
@@ -187,80 +187,147 @@ Value *lowerObjectSizeCall(
const TargetLibraryInfo *TLI, AAResults *AA, bool MustSucceed,
SmallVectorImpl *InsertedInstructions = nullptr);
-using SizeOffsetType = std::pair;
+/// SizeOffsetType - A base template class for the object size visito
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/76882
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
> I am unsure I understand why we do the base template rather than inheritance.
> Where is the base template used? If we do inheritance we could avoid
> duplicating of members and provide default impls that work with many things,
> e.g., all operator== are the same.
I made th
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/76882
>From ca7a96a40952fe94b916dacc52f07aa90bbdb1e7 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 3 Jan 2024 13:22:37 -0800
Subject: [PATCH 1/4] [builtin_object_size] Use classes instead of std::pair
(NFC
bwendling wrote:
@jdoerfert I reworked the structs to use inheritance instead of template
specialization. It should work better now and not duplicate so much.
https://github.com/llvm/llvm-project/pull/76882
___
cfe-commits mailing list
cfe-commits@lis
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/76882
>From ca7a96a40952fe94b916dacc52f07aa90bbdb1e7 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 3 Jan 2024 13:22:37 -0800
Subject: [PATCH 1/5] [builtin_object_size] Use classes instead of std::pair
(NFC
101 - 200 of 700 matches
Mail list logo