https://github.com/rapidsna approved this pull request.
https://github.com/llvm/llvm-project/pull/93231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -425,6 +425,12 @@ Attribute Changes in Clang
size_t count;
};
+- The attributes ``sized_by``, ``counted_by_or_null`` and ``sized_by_or_null```
+ have been added as variants on ``counted_by``, each with slightly different
semantics.
+ ``sized_by`` takes a
https://github.com/rapidsna edited
https://github.com/llvm/llvm-project/pull/93121
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4944,6 +4944,26 @@ void Parser::ParseStructDeclaration(
}
}
+// TODO: All callers of this function should be moved to
+// `Parser::ParseLexedAttributeList`.
+void Parser::ParseLexedCAttributeList(LateParsedAttrList , bool EnterScope,
+
@@ -4944,6 +4944,26 @@ void Parser::ParseStructDeclaration(
}
}
+// TODO: All callers of this function should be moved to
+// `Parser::ParseLexedAttributeList`.
+void Parser::ParseLexedCAttributeList(LateParsedAttrList , bool EnterScope,
+
@@ -0,0 +1,196 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#define __counted_by(f) __attribute__((counted_by(f)))
+
+struct bar;
+
+struct not_found {
+ int count;
+ struct bar *fam[] __counted_by(bork); // expected-error {{use of undeclared
identifier 'bork'}}
+};
+
https://github.com/rapidsna edited
https://github.com/llvm/llvm-project/pull/93121
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/93121
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
rapidsna wrote:
@bwendling @kees Likely, we should not put `__counted_by` in that case. Could
we fix the source?
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
rapidsna wrote:
@bwendling @kees Wait. `ATOM_PPLIB_STATE_V2` is also a struct with flexible
array member? This is concerning because `ucNumEntries *
sizeof(ATOM_PPLIB_STATE_V2)` is not the correct size anyway. Do you know the
semantics of this structure?
rapidsna wrote:
@bwendling Thanks for reporting. We will relax the restrictions for arrays to
not break the existing users.
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
rapidsna wrote:
> The main concern I have with delaying support for this is that header files
> could find themselves in a state where they could not be refactored without
> removing counted_by attributes that refer to now-incomplete structs.
@kees Agreed. We will work on a follow up patch to
rapidsna wrote:
> I've been thinking about this restriction. Why is this necessary? My
> assumption was that applying counted_by to a pointer causes a bounds check on
> an index into the pointer rather than its underlying type.
@bwendling It's because these types are not indexable really.
https://github.com/rapidsna closed
https://github.com/llvm/llvm-project/pull/87596
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -8547,15 +8547,25 @@ static const RecordDecl
*GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) {
return RD;
}
-static bool
-CheckCountExpr(Sema , FieldDecl *FD, Expr *E,
- llvm::SmallVectorImpl ) {
+static bool CheckCountedByAttrOnField(
+Sema ,
@@ -1371,14 +1371,23 @@ class Parser : public CodeCompletionHandler {
};
// A list of late-parsed attributes. Used by ParseGNUAttributes.
- class LateParsedAttrList: public SmallVector {
+ class LateParsedAttrList : public SmallVector {
rapidsna wrote:
https://github.com/rapidsna approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/88596
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2101,9 +2173,21 @@ bool PragmaClangAttributeSupport::isAttributedSupported(
return SpecifiedResult;
// Opt-out rules:
- // An attribute requires delayed parsing (LateParsed is on)
- if (Attribute.getValueAsBit("LateParsed"))
+
+ // An attribute requires delayed
@@ -89,13 +89,23 @@ static StringRef normalizeAttrName(StringRef Name) {
return Name;
}
-/// isAttributeLateParsed - Return true if the attribute has arguments that
-/// require late parsing.
-static bool isAttributeLateParsed(const IdentifierInfo ) {
+/// returns true iff
@@ -91,11 +91,24 @@ static StringRef normalizeAttrName(StringRef Name) {
/// isAttributeLateParsed - Return true if the attribute has arguments that
/// require late parsing.
-static bool isAttributeLateParsed(const IdentifierInfo ) {
+bool Parser::isAttributeLateParsed(const
@@ -592,6 +592,46 @@ class AttrSubjectMatcherAggregateRule
{
def SubjectMatcherForNamed : AttrSubjectMatcherAggregateRule;
+// Late Attribute parsing mode enum
+class LateAttrParseKind {
+ int Kind = val;
+}
+
+// Never late parsed
+def LateAttrParseNever :
@@ -592,6 +592,46 @@ class AttrSubjectMatcherAggregateRule
{
def SubjectMatcherForNamed : AttrSubjectMatcherAggregateRule;
+// Late Attribute parsing mode enum
rapidsna wrote:
@delcypher Thanks! LGTM.
https://github.com/llvm/llvm-project/pull/88596
@@ -592,6 +592,16 @@ class AttrSubjectMatcherAggregateRule
{
def SubjectMatcherForNamed : AttrSubjectMatcherAggregateRule;
+// Late Attribute parsing mode enum
+class LateAttrParseKind {
+ int Kind = val;
+}
+def LateAttrParseNever : LateAttrParseKind<0>; // Never late
rapidsna wrote:
> This should be fine, because count is declared before use—unless I'm getting
> type attributes confused with field attributes..
`struct size_unknown *__counted_by(count) buf` indicates that `buf` has
`sizeof(struct size_unknown) * count`
@@ -4997,7 +5087,11 @@ void Parser::ParseStructUnionBody(SourceLocation
RecordLoc,
ParsedAttributes attrs(AttrFactory);
// If attributes exist after struct contents, parse them.
- MaybeParseGNUAttributes(attrs);
+ MaybeParseGNUAttributes(attrs, );
+
+
https://github.com/rapidsna closed
https://github.com/llvm/llvm-project/pull/86017
___
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/86017
>From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Thu, 21 Mar 2024 06:47:05 +0900
Subject: [PATCH 1/3] Unwrap CountAttributed for debug info
Fix crash caused by
https://github.com/rapidsna updated
https://github.com/llvm/llvm-project/pull/86017
>From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Thu, 21 Mar 2024 06:47:05 +0900
Subject: [PATCH 1/2] Unwrap CountAttributed for debug info
Fix crash caused by
rapidsna wrote:
Fix crash in https://github.com/llvm/llvm-project/pull/78000
https://github.com/llvm/llvm-project/pull/86017
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
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
https://github.com/rapidsna created
https://github.com/llvm/llvm-project/pull/86017
Fix crash caused by 3eb9ff30959a670559bcba03d149d4c51bf7c9c9
>From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001
From: Yeoul Na
Date: Thu, 21 Mar 2024 06:47:05 +0900
Subject: [PATCH] Unwrap
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/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
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
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
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
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)) {
-
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
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 01/10] [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 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 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
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/8] [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/5] [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/4] [BoundsSafety] Introduce CountAttributedType
https://github.com/rapidsna closed
https://github.com/llvm/llvm-project/pull/70749
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/rapidsna created
https://github.com/llvm/llvm-project/pull/78000
In `-fbounds-safety`, bounds annotations are considered type attributes rather
than declaration attributes. Constructing them as type attributes allows us to
extend the attribute to apply nested pointers,
rapidsna wrote:
Rebased
https://github.com/llvm/llvm-project/pull/70749
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
rapidsna wrote:
> Thank you for the updates; the changes LGTM!
@AaronBallman Thanks for your review and insightful feedback!
https://github.com/llvm/llvm-project/pull/70749
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/rapidsna 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
https://github.com/rapidsna approved this pull request.
> Do you have anything to add?
LGTM
https://github.com/llvm/llvm-project/pull/76348
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
rapidsna wrote:
> The return value of -1 means "I don't know how large this is".
@kees Oh, I see. I did not know such the convention. Is it documented somewhere?
https://github.com/llvm/llvm-project/pull/76348
___
cfe-commits mailing list
rapidsna wrote:
> This prints a wrapped calculation instead of the expected "0".
Shouldn't `getDefaultBuiltinObjectSizeResult` return `-1`? Have you tried `-2`
to see if it's returning the negative count value or it happens to be equal to
the default value?
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -944,22 +951,262 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const
Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
+const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
+ASTContext , const RecordDecl *RD,
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const
Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
+const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
+ASTContext , const RecordDecl *RD,
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
https://github.com/rapidsna commented:
I left some comments. Looking good overall but `LocalDeclMap` doesn't seem to
serve the purpose for this PR. And I'm not sure the code block using it would
be actually necessary. Please see my inlined review.
@@ -944,22 +951,262 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const
Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
+const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
+ASTContext , const RecordDecl *RD,
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const
Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
+const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
+ASTContext , const RecordDecl *RD,
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -944,22 +951,259 @@ static llvm::Value
*getArrayIndexingBound(CodeGenFunction ,
return nullptr;
}
+namespace {
+
+/// \p StructAccessBase returns the base \p Expr of a field access. It returns
+/// either a \p DeclRefExpr, representing the base pointer to the struct,
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const
Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
+const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
+ASTContext , const RecordDecl *RD,
@@ -1155,15 +1159,14 @@ const FieldDecl
*CodeGenFunction::FindCountedByField(const FieldDecl *FD) {
return nullptr;
auto GetNonAnonStructOrUnion = [](const RecordDecl *RD) {
-while (RD && !RD->getDeclName())
- if (const auto *R =
https://github.com/rapidsna 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
1 - 100 of 229 matches
Mail list logo