@@ -74,6 +83,15 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
void unlock_scope(struct Mutex *const *mu)
__attribute__((release_capability(**mu)));
+// Verify late parsing:
+#ifdef LATE_PARSING
+struct LateParsing {
+ int a_value_defined_before
https://github.com/delcypher requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/94216
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -74,6 +83,15 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
void unlock_scope(struct Mutex *const *mu)
__attribute__((release_capability(**mu)));
+// Verify late parsing:
+#ifdef LATE_PARSING
+struct LateParsing {
+ int a_value_defined_before
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/94216
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta
%s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta
-fexperimental-late-parse-attributes %s
delcypher wrote:
@pdherbemont We should
@@ -3330,6 +3340,112 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// GuardedBy attributes (e.g., guarded_by):
+/// AttrName '(' expression ')'
+void Parser::ParseGuardedByAttribute(
+IdentifierInfo , SourceLocation AttrNameLoc,
+ParsedAttributes ,
@@ -3330,6 +3340,112 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// GuardedBy attributes (e.g., guarded_by):
+/// AttrName '(' expression ')'
+void Parser::ParseGuardedByAttribute(
+IdentifierInfo , SourceLocation AttrNameLoc,
+ParsedAttributes ,
@@ -3330,6 +3340,112 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// GuardedBy attributes (e.g., guarded_by):
+/// AttrName '(' expression ')'
+void Parser::ParseGuardedByAttribute(
+IdentifierInfo , SourceLocation AttrNameLoc,
+ParsedAttributes ,
@@ -3330,6 +3340,112 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// GuardedBy attributes (e.g., guarded_by):
+/// AttrName '(' expression ')'
+void Parser::ParseGuardedByAttribute(
+IdentifierInfo , SourceLocation AttrNameLoc,
+ParsedAttributes ,
@@ -3330,6 +3340,112 @@ void Parser::DistributeCLateParsedAttrs(Decl *Dcl,
}
}
+/// GuardedBy attributes (e.g., guarded_by):
+/// AttrName '(' expression ')'
+void Parser::ParseGuardedByAttribute(
+IdentifierInfo , SourceLocation AttrNameLoc,
+ParsedAttributes ,
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/94216
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -29,6 +29,13 @@ struct LOCKABLE Mutex {};
struct Foo {
struct Mutex *mu_;
+ int a_value GUARDED_BY(mu_);
delcypher wrote:
@pdherbemont I think you should be checking **both** late and regular parsing
for all attributes that you're adding support for.
https://github.com/delcypher requested changes to this pull request.
@pdherbemont thanks for working on this. It looks pretty good and its great to
see the late parsing support I added gaining new users. I just have some nits
about missing test cases.
delcypher wrote:
@AaronBallman
> I'd like to understand why we need a flag for this rather than changing the
> behavior of `-fbounds-safety`. (I'd like to avoid a proliferation of flags
> unless this flag is going to gate more changes in the near future.)
This is a good question so let me
@@ -8641,22 +8641,33 @@ enum class CountedByInvalidPointeeTypeKind {
VALID,
};
-static bool CheckCountedByAttrOnField(
-Sema , FieldDecl *FD, Expr *E,
-llvm::SmallVectorImpl ) {
+static bool
+CheckCountedByAttrOnField(Sema , FieldDecl *FD, Expr *E,
+
@@ -8641,22 +8641,33 @@ enum class CountedByInvalidPointeeTypeKind {
VALID,
};
-static bool CheckCountedByAttrOnField(
-Sema , FieldDecl *FD, Expr *E,
-llvm::SmallVectorImpl ) {
+static bool
+CheckCountedByAttrOnField(Sema , FieldDecl *FD, Expr *E,
+
@@ -8697,9 +8708,10 @@ static bool CheckCountedByAttrOnField(
InvalidTypeKind = CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER;
}
- if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID) {
+ if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID
@@ -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
@@ -8641,22 +8641,33 @@ enum class CountedByInvalidPointeeTypeKind {
VALID,
};
-static bool CheckCountedByAttrOnField(
-Sema , FieldDecl *FD, Expr *E,
-llvm::SmallVectorImpl ) {
+static bool
+CheckCountedByAttrOnField(Sema , FieldDecl *FD, Expr *E,
+
https://github.com/delcypher edited
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
@@ -8641,22 +8641,33 @@ enum class CountedByInvalidPointeeTypeKind {
VALID,
};
-static bool CheckCountedByAttrOnField(
-Sema , FieldDecl *FD, Expr *E,
-llvm::SmallVectorImpl ) {
+static bool
+CheckCountedByAttrOnField(Sema , FieldDecl *FD, Expr *E,
+
@@ -8641,22 +8641,33 @@ enum class CountedByInvalidPointeeTypeKind {
VALID,
};
-static bool CheckCountedByAttrOnField(
-Sema , FieldDecl *FD, Expr *E,
-llvm::SmallVectorImpl ) {
+static bool
+CheckCountedByAttrOnField(Sema , FieldDecl *FD, Expr *E,
+
https://github.com/delcypher requested changes to this pull request.
Looks pretty good. I have some minor comments.
https://github.com/llvm/llvm-project/pull/93231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
delcypher wrote:
@hnrklssn #93121 has been landed. Let's hope it sticks this time 爛
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
https://github.com/delcypher closed
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/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From c1f0914b1f8ae8416cebdf7f0573b4ff11f6110d Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH] [BoundsSafety] Reland #93121 Allow 'counted_by' attribute on
delcypher wrote:
Filed to #93263 to track the potential refactor.
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/delcypher 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/delcypher 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/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From 9e1a9e49b33d4b77d75cee243244dd66a40ea209 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH] [BoundsSafety] Reland #93121 Allow 'counted_by' attribute on
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From f9c8abdb243096b6fe0c2ad1a42023039ca7f1f2 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH] [BoundsSafety] Reland #93121 Allow 'counted_by' attribute on
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From bc5b8bc34b50e2e98d2c6103c7b1c232a3e765b4 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH] [BoundsSafety] Reland #93121 Allow 'counted_by' attribute on
@@ -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,
+
@@ -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,
+
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From 7f5af7cc180825e07b5f5292e3f6b860c8e8591e Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH 1/7] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
delcypher wrote:
Hmm looks like I'll have to tweak the assert. Looks like some unit tests don't
specify the language.
```
FAIL: Clang-Unit :: CodeGen/./ClangCodeGenTests/5/16 (19428 of 19653)
TEST 'Clang-Unit :: CodeGen/./ClangCodeGenTests/5/16'
FAILED
@@ -4993,20 +4993,8 @@ void Parser::ParseLexedCAttribute(LateParsedAttribute
,
"late field attribute expects to have at most one declaration.");
// Dispatch based on the attribute and parse it
- const AttributeCommonInfo::Form ParsedForm =
https://github.com/delcypher 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/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From 7f5af7cc180825e07b5f5292e3f6b860c8e8591e Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH 1/7] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/93121
>From 7f5af7cc180825e07b5f5292e3f6b860c8e8591e Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 12:07:40 -0700
Subject: [PATCH 1/6] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
delcypher wrote:
Okay this is interesting...
```
FAIL: Clang :: SemaObjC/warn-thread-safety-analysis.m (15515 of 19369)
TEST 'Clang :: SemaObjC/warn-thread-safety-analysis.m'
FAILED
Exit Code: 134
Command Output (stderr):
--
RUN:
delcypher wrote:
Hmm looks like I broke
```
Clang :: Sema/attr-capabilities.c
Clang :: Sema/diagnose_if.c
Clang :: Sema/warn-thread-safety-analysis.c
Clang :: SemaObjC/warn-thread-safety-analysis.m
```
Let's see if I can figure out what I did...
delcypher wrote:
This is blocked by #93121
https://github.com/llvm/llvm-project/pull/92623
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
delcypher wrote:
@rapidsna Please check 604e274a5bc37b18c3bc89eed5749c8617de36e7 to check you
are happy with the way I'm fixing the memory leak.
https://github.com/llvm/llvm-project/pull/93121
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -744,7 +744,13 @@ void Parser::ParseLexedAttributeList(LateParsedAttrList
, Decl *D,
for (unsigned i = 0, ni = LAs.size(); i < ni; ++i) {
if (D)
LAs[i]->addDecl(D);
-ParseLexedAttribute(*LAs[i], EnterScope, OnDefinition);
+// FIXME: There has to be a
https://github.com/delcypher created
https://github.com/llvm/llvm-project/pull/93121
This PR attempts to reland https://github.com/llvm/llvm-project/pull/90786 that
was reverted due to a memory leak.
This PR includes the following commits
1. The original commit in #90786 (originally
delcypher wrote:
@erichkeane I posted the comment on the wrong PR. The memory leak is in #90786
not this PR so I deleted the comment i made here. #90786 has already been
reverted.
https://github.com/llvm/llvm-project/pull/88596
___
cfe-commits
delcypher wrote:
I'll put up a new version of this PR with the memory leak fixed soon.
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
delcypher wrote:
Ok. Now I see what's happening.
These lines here are basically giving ownership of `LateParsedAttribute` to the
`LateParsedAttrList`
```
// Handle attributes with arguments that require late parsing.
LateParsedAttribute *LA =
new
delcypher wrote:
The leak via `clang::Parser::ParseLexedCAttribute` is
```c++
LA.Toks.push_back(AttrEnd);
```
and the leak via `clang::Parser::ParseGNUAttributes`
is
```
LateParsedAttribute *LA =
new LateParsedAttribute(this, *AttrName, AttrNameLoc);
```
which is really
delcypher wrote:
Hmm. Apparently there's a memory leak.
https://lab.llvm.org/buildbot/#/builders/239/builds/7043
```
-- Testing: 79948 of 79949 tests, 48 workers --
Testing:
FAIL: Clang :: AST/attr-counted-by-late-parsed-struct-ptrs.c (480 of 79948)
TEST 'Clang ::
delcypher wrote:
Hmm. Apparently there's a memory leak.
https://lab.llvm.org/buildbot/#/builders/239/builds/7043
```
-- Testing: 79948 of 79949 tests, 48 workers --
Testing:
FAIL: Clang :: AST/attr-counted-by-late-parsed-struct-ptrs.c (480 of 79948)
TEST 'Clang ::
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/92623
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/92623
>From ef46dd51c5c54cf5a76d83b9c15f8f3aee052e42 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 17 May 2024 17:15:48 -0700
Subject: [PATCH] [BoundsSafety] Add `-fexperimental-bounds-safety` CC1 and
language
delcypher wrote:
This is based on #70480 but removes the driver part of the change and makes the
flag a CC1 flag only.
https://github.com/llvm/llvm-project/pull/92623
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/delcypher created
https://github.com/llvm/llvm-project/pull/92623
This adds the `-fexperimental-bounds-safety` cc1 and corresponding language
option. This language option enables "-fbounds-safety" which is a bounds-safety
extension for C that is being incrementally
delcypher wrote:
@kees @bwendling @rapidsna The workaround to downgrade this error to a warning
has landed
https://github.com/llvm/llvm-project/commit/cef6387e52578366c2332275dad88b9953b55336
https://github.com/llvm/llvm-project/pull/90786
___
Author: Dan Liew
Date: 2024-05-17T16:23:24-07:00
New Revision: cef6387e52578366c2332275dad88b9953b55336
URL:
https://github.com/llvm/llvm-project/commit/cef6387e52578366c2332275dad88b9953b55336
DIFF:
https://github.com/llvm/llvm-project/commit/cef6387e52578366c2332275dad88b9953b55336.diff
delcypher wrote:
@bwendling This is unfortunate
```
drivers/gpu/drm/radeon/pptable.h:442:5: error: 'counted_by' cannot be applied
to an array with element of unknown size because 'ATOM_PPLIB_STATE_V2' (aka
'struct _ATOM_PPLIB_STATE_V2') is a struct type with a flexible array member
442 |
delcypher wrote:
Test fixed by `112eadd55f06bee15caadff688ea0b45acbfa804`.
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Dan Liew
Date: 2024-05-17T13:09:22-07:00
New Revision: 112eadd55f06bee15caadff688ea0b45acbfa804
URL:
https://github.com/llvm/llvm-project/commit/112eadd55f06bee15caadff688ea0b45acbfa804
DIFF:
https://github.com/llvm/llvm-project/commit/112eadd55f06bee15caadff688ea0b45acbfa804.diff
delcypher wrote:
Looks like I broke the
`clang/test/Misc/pragma-attribute-supported-attributes-list.test` test. I'll
push a follow up fix to that test once I've confirmed I've fixed it.
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits
https://github.com/delcypher closed
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/90786
>From 80dbab4c4b43eb78f29b7b8fa577f04772a7f52c Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH] [BoundsSafety] Allow 'counted_by' attribute on pointers in
structs
delcypher wrote:
@kees Thanks for approving.
I'm going to resolve the merge conflict in `clang/docs/ReleaseNotes.rst` and
then merge. I'll start looking at supporting `__counted_by()` on incomplete
pointee types next. @hnrklssn is going to start working on upstreaming the
`__sized_by`
https://github.com/delcypher closed
https://github.com/llvm/llvm-project/pull/91032
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/90786
>From e6fb7a3374ada3d02b4c89263ffd14a037a7e56a Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH] [BoundsSafety] Allow 'counted_by' attribute on pointers in
structs
delcypher wrote:
@bwendling @kees Any further feedback? If not, can you approve?
As @rapidsna said we'll follow up this PR with additional PRs to address the
two major concerns you had.
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits
@@ -0,0 +1,187 @@
+// 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/delcypher updated
https://github.com/llvm/llvm-project/pull/90786
>From 1f4d924768409d6bc61d160c6161e6acebf62b60 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH 1/4] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
delcypher wrote:
> It's not a lie, because the contents of a pointer don't contribute to the
> size of the struct containing that pointer.
Consider this example. It tries to illustrate why putting `__counted_by()` on a
pointer to a structs containing flexible array members doesn't make sense.
delcypher wrote:
> @rapidsna @delcypher @apple-fcloutier @kees:
>
> Okay, I think I see what the complication is. Are you trying to prevent the
> use case of someone writing something like:
>
> ```c
> struct bar;
>
> struct foo {
> size_t count;
> struct bar *ptr __counted_by(count);
>
delcypher wrote:
@vitalybuka Ping
https://github.com/llvm/llvm-project/pull/91032
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -172,6 +172,27 @@ static bool checkArgCount(Sema , CallExpr *Call,
unsigned DesiredArgCount) {
<< /*is non object*/ 0 << Call->getArg(1)->getSourceRange();
}
+static bool checkBuiltinVerboseTrap(CallExpr *Call, Sema ) {
delcypher wrote:
delcypher wrote:
@bwendling
> 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.
@rapidsna Please add additional points if I
https://github.com/delcypher created
https://github.com/llvm/llvm-project/pull/91032
Due to how `CodeGenFunction::EmitTrapCheck` is implemented `SanitizerHandler`
with numeric value 0x19 needs to be reserved because `-fbounds-safety`
generates trap instructions with that value embedded in the
@@ -335,6 +336,22 @@ Attribute Changes in Clang
- Clang now warns that the ``exclude_from_explicit_instantiation`` attribute
is ignored when applied to a local class or a member thereof.
+- The ``counted_by`` attribute can now be late parsed in C when
@@ -6534,6 +6536,15 @@ def err_counted_by_attr_refer_to_union : Error<
"'counted_by' argument cannot refer to a union member">;
def note_flexible_array_counted_by_attr_field : Note<
"field %0 declared here">;
+def err_counted_by_attr_pointee_unknown_size : Error<
+
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/90786
>From 1f4d924768409d6bc61d160c6161e6acebf62b60 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH 1/3] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
@@ -631,6 +631,18 @@ bool Type::isStructureType() const {
return false;
}
+bool Type::isStructureTypeWithFlexibleArrayMember() const {
+ const auto *RT = getAs();
+ if (!RT)
+return false;
+ const auto *Decl = RT->getDecl();
+ if (!Decl->isStruct())
+return
@@ -6534,6 +6536,15 @@ def err_counted_by_attr_refer_to_union : Error<
"'counted_by' argument cannot refer to a union member">;
def note_flexible_array_counted_by_attr_field : Note<
"field %0 declared here">;
+def err_counted_by_attr_pointee_unknown_size : Error<
+
@@ -335,6 +336,22 @@ Attribute Changes in Clang
- Clang now warns that the ``exclude_from_explicit_instantiation`` attribute
is ignored when applied to a local class or a member thereof.
+- The ``counted_by`` attribute can now be late parsed in C when
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/90786
>From 1f4d924768409d6bc61d160c6161e6acebf62b60 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH 1/2] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
@@ -8588,31 +8588,71 @@ static const RecordDecl
*GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) {
return RD;
}
-static bool
-CheckCountExpr(Sema , FieldDecl *FD, Expr *E,
- llvm::SmallVectorImpl ) {
+enum class CountedByInvalidPointeeTypeKind {
+
delcypher wrote:
@rapidsna You may want to close this PR but I'll leave this up to you.
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
delcypher wrote:
@rapidsna I've put my version of this PR in my own pull request because when I
edit the PR summary here it looks like you wrote it which is weird:
https://github.com/llvm/llvm-project/pull/90786
https://github.com/llvm/llvm-project/pull/87596
https://github.com/delcypher created
https://github.com/llvm/llvm-project/pull/90786
Previously the attribute was only allowed on flexible array members. This patch
patch changes this to also allow the attribute on pointer fields in structs and
also allows late parsing of the attribute in
https://github.com/delcypher edited
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
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From a89cca7fecae5ef5130cd9c8da834a186e99dbb5 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH] [BoundsSafety] Allow 'counted_by' attribute on pointers in
structs
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From 50e628d2d6fb496c1cb2fa188b653529508e383c Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH] [BoundsSafety] Allow 'counted_by' attribute on pointers in
structs
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From 4e6130ea07e655081df3f2ca9c89fd1be035a68d Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Wed, 1 May 2024 13:56:52 -0700
Subject: [PATCH] [BoundsSafety] Allow 'counted_by' attribute on pointers in
structs
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From 03266b74d973075eb5dfa27f32bb9c1bb75d73f9 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Mon, 29 Apr 2024 16:46:31 -0700
Subject: [PATCH 1/4] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From 03266b74d973075eb5dfa27f32bb9c1bb75d73f9 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Mon, 29 Apr 2024 16:46:31 -0700
Subject: [PATCH 1/4] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From 03266b74d973075eb5dfa27f32bb9c1bb75d73f9 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Mon, 29 Apr 2024 16:46:31 -0700
Subject: [PATCH 1/3] [BoundsSafety] Allow 'counted_by' attribute on pointers
in
https://github.com/delcypher closed
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
delcypher wrote:
@erichkeane Thanks for approving. I'll rebase, check this builds and then land
this.
@AaronBallman When you're back please let me know if there's any follow up
changes you want.
https://github.com/llvm/llvm-project/pull/88596
___
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/88596
>From 07ab74ac8829e6c3e4365e1a87148d21800437d3 Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Tue, 23 Apr 2024 14:57:46 -0700
Subject: [PATCH] [Attributes] Support Attributes being declared as supporting
an
https://github.com/delcypher updated
https://github.com/llvm/llvm-project/pull/87596
>From b859cf056df24daa85f3fd305ef56f32e0f266ed Mon Sep 17 00:00:00 2001
From: Dan Liew
Date: Fri, 12 Apr 2024 17:36:19 -0700
Subject: [PATCH 1/4] [Attributes] Support Attributes being declared as
supporting
1 - 100 of 250 matches
Mail list logo