rapidsna wrote:
Thanks @nathanchance. Opened PR to fix the crash.
https://github.com/llvm/llvm-project/pull/86017
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
delcypher wrote:
@nathanchance Thanks for reporting this. I'm going to have a quick go at
reproducing this to see if fixing this is straight forward. If it is not I will
revert this PR and then we can re-land this change with the problem you
reported fixed.
nathanchance wrote:
I see a crash from an unreachable statement while building the Linux kernel
with debug info enabled after this change. A trivial reproducer from `cvise`:
```c
struct {
int num_counters;
long value[] __attribute__((__counted_by__(num_counters)));
}
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/14] [BoundsSafety] Introduce CountAttributedType
rapidsna wrote:
@AaronBallman Thank you! The -fbounds-safety documentation is currently shown
https://clang.llvm.org/docs/BoundsSafety.html, but yes, we're planning to add
the feature in the release note once we have more functionalities in place.
https://github.com/AaronBallman approved this pull request.
Thank you for this, it's exciting to see more bounds safety being added to
Clang!
I think everything looks good to me (we can clean up any surprises in
follow-ups at this point). I'm presuming you'll add a release note & docs once
https://github.com/yinying-lisa-li updated
https://github.com/llvm/llvm-project/pull/78000
>From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/13] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/11] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/10] [BoundsSafety] Introduce CountAttributedType
https://github.com/Endilll commented:
`Sema.h` changes look good to me.
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
rapidsna wrote:
@Endilll I just rebased it so you can review `Sema.h`.
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType
Endilll wrote:
Can you resolve merge conflicts, so that I can review changes to `Sema.h`?
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/8] [BoundsSafety] Introduce CountAttributedType
rapidsna wrote:
@AaronBallman thanks for the review! I addressed your comments.
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2000,6 +2001,21 @@ class alignas(TypeAlignment) Type : public
ExtQualsTypeCommonBase {
unsigned NumExpansions;
};
+ class CountAttributedTypeBitfields {
+friend class CountAttributedType;
+
+LLVM_PREFERRED_TYPE(TypeBitfields)
+unsigned : NumTypeBits;
+
@@ -1117,6 +1117,32 @@ class ObjCInterfaceTypeLoc : public
ConcreteTypeLoc {
+public:
+ TypeLoc getInnerLoc() const { return this->getInnerTypeLoc(); }
+ QualType getInnerType() const { return this->getTypePtr()->desugar(); }
+ void initializeLocal(ASTContext , SourceLocation
@@ -4259,7 +4240,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
if (const auto *ME = dyn_cast(Array);
ME &&
ME->isFlexibleArrayMemberLike(getContext(), StrictFlexArraysLevel) &&
-
@@ -13233,6 +13262,32 @@ static QualType getCommonSugarTypeNode(ASTContext
, const Type *X,
return QualType();
return Ctx.getUsingType(CD, Ctx.getQualifiedType(Underlying));
}
+ case Type::CountAttributed: {
+const auto *DX = cast(X),
+ *DY =
@@ -7239,6 +7239,13 @@ QualType
TreeTransform::TransformAttributedType(TypeLocBuilder ,
});
}
+template
+QualType TreeTransform::TransformCountAttributedType(
+TypeLocBuilder , CountAttributedTypeLoc TL) {
+ // TODO
+ llvm_unreachable("Unexpected TreeTransform
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/7] [BoundsSafety] Introduce CountAttributedType
https://github.com/erichkeane commented:
No additional comments from me, if the other reviewers are happy, I'm happy
with where this is/is going.
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -2000,6 +2001,21 @@ class alignas(TypeAlignment) Type : public
ExtQualsTypeCommonBase {
unsigned NumExpansions;
};
+ class CountAttributedTypeBitfields {
+friend class CountAttributedType;
+
+LLVM_PREFERRED_TYPE(TypeBitfields)
+unsigned : NumTypeBits;
+
@@ -1117,6 +1117,32 @@ class ObjCInterfaceTypeLoc : public
ConcreteTypeLoc {
+public:
+ TypeLoc getInnerLoc() const { return this->getInnerTypeLoc(); }
+ QualType getInnerType() const { return this->getTypePtr()->desugar(); }
+ void initializeLocal(ASTContext , SourceLocation
@@ -7239,6 +7239,13 @@ QualType
TreeTransform::TransformAttributedType(TypeLocBuilder ,
});
}
+template
+QualType TreeTransform::TransformCountAttributedType(
+TypeLocBuilder , CountAttributedTypeLoc TL) {
+ // TODO
+ llvm_unreachable("Unexpected TreeTransform
@@ -1136,38 +1136,19 @@ llvm::Value *CodeGenFunction::EmitCountedByFieldExpr(
}
const FieldDecl *CodeGenFunction::FindCountedByField(const FieldDecl *FD) {
- if (!FD || !FD->hasAttr())
+ if (!FD)
return nullptr;
- const auto *CBA = FD->getAttr();
- if (!CBA)
+
@@ -4259,7 +4240,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const
ArraySubscriptExpr *E,
if (const auto *ME = dyn_cast(Array);
ME &&
ME->isFlexibleArrayMemberLike(getContext(), StrictFlexArraysLevel) &&
-
@@ -13233,6 +13262,32 @@ static QualType getCommonSugarTypeNode(ASTContext
, const Type *X,
return QualType();
return Ctx.getUsingType(CD, Ctx.getQualifiedType(Underlying));
}
+ case Type::CountAttributed: {
+const auto *DX = cast(X),
+ *DY =
@@ -385,6 +385,26 @@ void DependentBitIntType::Profile(llvm::FoldingSetNodeID
,
NumBitsExpr->Profile(ID, Context, true);
}
+bool BoundsAttributedType::referencesFieldDecls() const {
+ for (const auto : dependent_decls())
+if (isa(Decl.getDecl()))
+ return true;
https://github.com/AaronBallman commented:
Thank you for your patience! Overall, I don't spot any major concerns, but I
did spot some minor nits. I've added @erichkeane to the review as attributes
code owner for a second set of eyes on those changes specifically.
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2000,6 +2001,21 @@ class alignas(TypeAlignment) Type : public
ExtQualsTypeCommonBase {
unsigned NumExpansions;
};
+ class CountAttributedTypeBitfields {
+friend class CountAttributedType;
+
+LLVM_PREFERRED_TYPE(TypeBitfields)
+unsigned : NumTypeBits;
+
rapidsna wrote:
Gentle reminder @bwendling @AaronBallman. I'd like to land this patch soon, so
we can open source more of -fbounds-safety work. Could you please take a look?
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/6] [BoundsSafety] Introduce CountAttributedType
@@ -8463,133 +8463,115 @@ static void handleZeroCallUsedRegsAttr(Sema , Decl
*D, const ParsedAttr ) {
D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL));
}
-static void handleCountedByAttr(Sema , Decl *D, const ParsedAttr ) {
- if (!AL.isArgIdent(0)) {
-
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/4] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/3] [BoundsSafety] Introduce CountAttributedType
rapidsna wrote:
@AaronBallman @erichkeane gentle reminder. Does my reasoning
[above](https://github.com/llvm/llvm-project/pull/78000#issuecomment-1932496432)
to make a new sugar type make sense?
https://github.com/llvm/llvm-project/pull/78000
___
rapidsna wrote:
Thanks @AaronBallman!
> I think AttributedType might be a reasonable way forward. That's how we model
> nullability qualifiers, for example:
The difference from nullability qualifiers is that they are actually encoded as
`AttributeKind`, whereas `__counted_by` has to store
AaronBallman wrote:
> > One possibility would be to use a type qualifier? It has basically the kind
> > of properties you want... the underlying type is
> > still there, and places that strip qualifiers will automatically do the
> > right thing in a lot of cases. It might require a bit more
>
rapidsna wrote:
FWIW, in the context of `-fbounds-safety`
(https://github.com/llvm/llvm-project/blob/main/clang/docs/BoundsSafety.rst), I
think the best is to have the bounds-annotated types to be part of the
canonical type system because they affect the semantics and the codegen (again
with
rapidsna wrote:
> One possibility would be to use a type qualifier? It has basically the kind
> of properties you want... the underlying type is > still there, and places
> that strip qualifiers will automatically do the right thing in a lot of
> cases. It might require a bit more > work to
@@ -2917,6 +2942,133 @@ class PointerType : public Type, public
llvm::FoldingSetNode {
static bool classof(const Type *T) { return T->getTypeClass() == Pointer; }
};
+/// [BoundsSafety] Represents information of declarations referenced by the
+/// arguments of the
https://github.com/rapidsna edited
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -8463,133 +8463,110 @@ static void handleZeroCallUsedRegsAttr(Sema , Decl
*D, const ParsedAttr ) {
D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL));
}
-static void handleCountedByAttr(Sema , Decl *D, const ParsedAttr ) {
- if (!AL.isArgIdent(0)) {
-
efriedma-quic wrote:
One possibility would be to use a type qualifier? It has basically the kind of
properties you want... the underlying type is still there, and places that
strip qualifiers will automatically do the right thing in a lot of cases. It
might require a bit more work to handle
rapidsna wrote:
> It's generally not a good idea to use sugar to represent constructs that are
> semantically significant: anything that uses the canonical type will throw it
> away. We try to avoid throwing away sugar in most cases, but we aren't always
> successful.
> It's possible there
efriedma-quic wrote:
It's generally not a good idea to use sugar to represent constructs that are
semantically significant: anything that uses the canonical type will throw it
away. We try to avoid throwing away sugar in most cases, but we aren't always
successful.
It's possible there are
rapidsna wrote:
@AaronBallman @bwendling I'd appreciate your feedback!
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/2] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna ready_for_review
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH] [BoundsSafety] Introduce CountAttributedType
CountAttributedType is
https://github.com/rapidsna converted_to_draft
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/13] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/12] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/12] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 01/11] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/78000
>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna edited
https://github.com/llvm/llvm-project/pull/78000
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
60 matches
Mail list logo