[all-commits] [llvm/llvm-project] b42a74: [Clang] Fix 'counted_by' for nested struct pointer...
Bill Wendling via All-commits
all-commits at lists.llvm.org
Thu Oct 10 23:04:53 PDT 2024
Branch: refs/heads/release/19.x
Home: https://github.com/llvm/llvm-project
Commit: b42a74febeb6f2486403f4fa37e3169fce9eb091
https://github.com/llvm/llvm-project/commit/b42a74febeb6f2486403f4fa37e3169fce9eb091
Author: Jan Hendrik Farr <Cydox at users.noreply.github.com>
Date: 2024-10-11 (Fri, 11 Oct 2024)
Changed paths:
M clang/lib/CodeGen/CGExpr.cpp
A clang/test/CodeGen/attr-counted-by-pr110385.c
M clang/test/CodeGen/attr-counted-by.c
Log Message:
-----------
[Clang] Fix 'counted_by' for nested struct pointers (#110497)
Fix counted_by attribute for cases where the flexible array member is
accessed through struct pointer inside another struct:
```
struct variable {
int a;
int b;
int length;
short array[] __attribute__((counted_by(length)));
};
struct bucket {
int a;
struct variable *growable;
int b;
};
```
__builtin_dynamic_object_size(p->growable->array, 0);
This commit makes sure that if the StructBase is both a MemberExpr and a
pointer, it is treated as a pointer. Otherwise clang will generate to
code to access the address of p->growable intead of loading the value of
p->growable->length.
Fixes #110385
Commit: 6c1fd539e43ea3c3bf052495704403a76d4e7979
https://github.com/llvm/llvm-project/commit/6c1fd539e43ea3c3bf052495704403a76d4e7979
Author: Bill Wendling <morbo at google.com>
Date: 2024-10-11 (Fri, 11 Oct 2024)
Changed paths:
M clang/lib/CodeGen/CGExpr.cpp
Log Message:
-----------
[Clang] Check that we have the correct RecordDecl
Ensure we have the correct RecordDecl before returning the Expr we're
looking for.
Compare: https://github.com/llvm/llvm-project/compare/149884a1469d...6c1fd539e43e
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list