[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Yeoul Na via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via 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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via 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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-05-01 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-30 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-30 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-29 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-29 Thread Dan Liew via cfe-commits
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

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-23 Thread Yeoul Na via 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 ,

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-22 Thread Dan Liew via cfe-commits
delcypher wrote: @rapidsna I've addressed the "Make it an error to use 'counted_by' on size-less types (e.g., forward declared structs)" TODO. I still need to test this PR properly and write a proper commit message explaining what this does. https://github.com/llvm/llvm-project/pull/87596

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-22 Thread Dan Liew via cfe-commits
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/2] [Attributes] Support Attributes being declared as supporting

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-19 Thread Dan Liew via cfe-commits
delcypher wrote: The implementation of the experimental late attribute changed (#88596) so I've rebased this PR on it and fixed it up to work as intended. https://github.com/llvm/llvm-project/pull/87596 ___ cfe-commits mailing list

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-19 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/87596 >From 24ea6b9306e0da81b956718590bff3c3cfb9124c Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Fri, 12 Apr 2024 17:36:19 -0700 Subject: [PATCH 1/2] [Attributes] Support Attributes being declared as supporting

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Dan Liew via cfe-commits
delcypher wrote: @rapidsna @bwendling I've put the experimental feature flag for late parsing in a separate PR (#88596). I've not updated this PR to be based on that PR yet but will do soon. I figured the code for experimental feature flag was large enough that it deserved its own PR to make

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/87596 >From af735f3216dd5db9dcaf164892f3f573731701ec Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Wed, 3 Apr 2024 20:58:46 -0700 Subject: [PATCH 1/3] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields;

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Yeoul Na via cfe-commits
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`

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Bill Wendling via cfe-commits
@@ -4997,7 +5087,11 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParsedAttributes attrs(AttrFactory); // If attributes exist after struct contents, parse them. - MaybeParseGNUAttributes(attrs); + MaybeParseGNUAttributes(attrs, ); + +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Bill Wendling via cfe-commits
bwendling wrote: FYI: I'm planning on having a separate `test/Sema/attr-counted-by-for-pointers.c` test file for pointers and rename the current file something like `test/Sema/attr-counted-by-for-flexible-array-members.c`.

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-12 Thread Bill Wendling via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_unknown; + +struct at_pointer { + int count; + struct size_unknown *__counted_by(count) buf; // expected-error{{'counted_by' cannot be

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-11 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/87596 >From af735f3216dd5db9dcaf164892f3f573731701ec Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Wed, 3 Apr 2024 20:58:46 -0700 Subject: [PATCH 1/2] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields;

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-10 Thread Dan Liew via cfe-commits
@@ -1599,6 +1599,13 @@ defm double_square_bracket_attributes : BoolFOption<"double-square-bracket-attri LangOpts<"DoubleSquareBracketAttributes">, DefaultTrue, PosFlag, NegFlag>; +defm experimental_late_parse_attributes : BoolFOption<"experimental-late-parse-attributes",

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-10 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/87596 >From af735f3216dd5db9dcaf164892f3f573731701ec Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Wed, 3 Apr 2024 20:58:46 -0700 Subject: [PATCH 1/2] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields;

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Yeoul Na via cfe-commits
@@ -4997,7 +5087,11 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParsedAttributes attrs(AttrFactory); // If attributes exist after struct contents, parse them. - MaybeParseGNUAttributes(attrs); + MaybeParseGNUAttributes(attrs, ); + +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Dan Liew via cfe-commits
@@ -4872,6 +4886,79 @@ void Parser::ParseStructDeclaration( } } +// Parse all attributes in LA, and attach them to Decl D. +void Parser::ParseLexedCAttributeList(LateParsedAttrList , bool EnterScope, ParsedAttributes *OutAttrs) { + assert(LA.parseSoon() && +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Dan Liew via cfe-commits
@@ -4997,7 +5087,11 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParsedAttributes attrs(AttrFactory); // If attributes exist after struct contents, parse them. - MaybeParseGNUAttributes(attrs); + MaybeParseGNUAttributes(attrs, ); + +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Dan Liew via cfe-commits
@@ -4872,6 +4886,79 @@ void Parser::ParseStructDeclaration( } } +// Parse all attributes in LA, and attach them to Decl D. +void Parser::ParseLexedCAttributeList(LateParsedAttrList , bool EnterScope, ParsedAttributes *OutAttrs) { + assert(LA.parseSoon() && +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Dan Liew via cfe-commits
@@ -4872,6 +4886,79 @@ void Parser::ParseStructDeclaration( } } +// Parse all attributes in LA, and attach them to Decl D. +void Parser::ParseLexedCAttributeList(LateParsedAttrList , bool EnterScope, ParsedAttributes *OutAttrs) { + assert(LA.parseSoon() && +

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-05 Thread Dan Liew via cfe-commits
@@ -2497,7 +2501,9 @@ class Parser : public CodeCompletionHandler { void ParseStructDeclaration( ParsingDeclSpec , - llvm::function_ref FieldsCallback); + llvm::function_ref delcypher wrote: Why are we adding using `Decl*&` as a parameter?