ahatanak updated this revision to Diff 81090.
ahatanak added a comment.
Address review comments.
- Arrays marked "flexible_array" are now treated as flexible arrays.
- __builtin_object_size returns a more accurate numbers for normal C99 flexible
arrays (see test/CodeGen/object-size.c).
Note tha
ahatanak added inline comments.
Comment at: include/clang/AST/Decl.h:3250
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
+
ahatanak wrote:
> rsmith wrote:
> > How is this different from `HasFlexibl
ahatanak added inline comments.
Comment at: include/clang/AST/Decl.h:3250
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
+
rsmith wrote:
> How is this different from `HasFlexibleArrayMember`? Do we
rsmith added inline comments.
Comment at: include/clang/AST/Decl.h:3250
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
+
How is this different from `HasFlexibleArrayMember`? Do we really need both?
ahatanak added a comment.
ping
https://reviews.llvm.org/D21453
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
LGTM with one small testing nit, but you should wait for @rsmith to chime in
since he had comments previously.
Comment at: test/SemaCXX/flexible-array-attr.cpp:52
@@ +51,3 @@
+ int a[4];
+ int b[4] __attribu
ahatanak added a comment.
ping
https://reviews.llvm.org/D21453
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ahatanak added inline comments.
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2170
@@ +2169,3 @@
+ "'flexible_array' attribute only applies to %select{"
+ "the last member of a struct|members of structs or classes|"
+ "fixed sized array members|array members that have
ahatanak updated this revision to Diff 63596.
ahatanak added a comment.
Change diagnostic messages.
http://reviews.llvm.org/D21453
Files:
include/clang/AST/Decl.h
include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/
aaron.ballman added inline comments.
Comment at: include/clang/AST/Decl.h:3249
@@ -3248,1 +3248,3 @@
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
ahatanak wrote:
> Probably it can be looked up a
ahatanak marked 7 inline comments as done.
Comment at: include/clang/AST/Decl.h:3249
@@ -3248,1 +3248,3 @@
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
Probably it can be looked up although it w
ahatanak updated this revision to Diff 63299.
ahatanak added a comment.
Address review comments.
http://reviews.llvm.org/D21453
Files:
include/clang/AST/Decl.h
include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Att
aaron.ballman added inline comments.
Comment at: include/clang/AST/Decl.h:3249
@@ -3248,1 +3248,3 @@
+ /// This is true if this struct ends with an array marked 'flexible_array'.
+ bool HasFlexibleArrayAttr : 1;
Does this require a bit, or can this simply be l
ahatanak updated this revision to Diff 62560.
ahatanak added a comment.
The new patch defines a new attribute "flexible_array", which gets attached to
the last array member of a struct.
I made changes to clang to treat arrays marked "flexible_array" as C99's
flexible array members where it made
ahatanak added a comment.
I think you are right. There are other places that need to be fixed to properly
support over-allocated structures. I'll see if I can come up with a patch that
treats the over-allocated array as flexible array member.
http://reviews.llvm.org/D21453
_
rsmith requested changes to this revision.
Comment at: include/clang/Basic/AttrDocs.td:2073-2079
@@ +2072,9 @@
+ let Content = [{
+Use ``overallocated`` to indicate a class or union can have extra memory
+allocated at its end. This attribute is primarily used when we want
+__buil
On Mon, Jun 27, 2016 at 2:07 PM, Duncan P. N. Exon Smith
wrote:
>
>> On 2016-Jun-27, at 11:02, Aaron Ballman wrote:
>>
>> aaron.ballman requested changes to this revision.
>> aaron.ballman added a comment.
>> This revision now requires changes to proceed.
>>
>> Missing Sema tests for the attribut
> On 2016-Jun-27, at 11:02, Aaron Ballman wrote:
>
> aaron.ballman requested changes to this revision.
> aaron.ballman added a comment.
> This revision now requires changes to proceed.
>
> Missing Sema tests for the attribute.
>
>
>
> Comment at: include/clang/Basic/AttrDocs.
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.
Missing Sema tests for the attribute.
Comment at: include/clang/Basic/AttrDocs.td:2082
@@ +2081,3 @@
+
+struct S {
+ char a[4], char b[4];
---
ahatanak updated this revision to Diff 61743.
ahatanak added a comment.
Address review comments and change the wording in AttrDocs.td to explain what
the attribute means and how it is used. Also, fixed the code in VisitMemberExpr
to set LValue::OverAllocated before the base class of the member e
george.burgess.iv added a comment.
Thanks for the patch!
Comment at: lib/AST/ExprConstant.cpp:1055
@@ +1054,3 @@
+// computation of __builtin_object_size.
+bool OverAllocated = 1;
+
Did you mean `: 1` here?
http://reviews.llvm.org/D21453
___
aaron.ballman added inline comments.
Comment at: include/clang/Basic/Attr.td:2279
@@ +2278,3 @@
+ let Spellings = [GNU<"overallocated">, CXX11<"clang", "overallocated">];
+ let Subjects = SubjectList<[Record], ErrorDiag, "ExpectedStructOrUnion">;
+ let Documentation = [OverAllo
ahatanak added inline comments.
Comment at: include/clang/Basic/AttrDocs.td:2073-2079
@@ +2072,9 @@
+ let Content = [{
+Use ``overallocated`` to indicate a struct or union is over-allocated. For
example,
+
+.. code-block:: c++
+
+struct S {
+ char a[4], char b[4];
+} __attribut
ahatanak updated this revision to Diff 61145.
ahatanak added a comment.
Fix a bug in tryEvaluateBuiltinObjectSize. If the pointer passed to
__builtin_object_size doesn't point to an array, it should be able to compute
the exact size of the subobject the pointer points to. Therefore, it should be
rsmith added inline comments.
Comment at: include/clang/Basic/AttrDocs.td:2073-2079
@@ +2072,9 @@
+ let Content = [{
+Use ``overallocated`` to indicate a struct or union is over-allocated. For
example,
+
+.. code-block:: c++
+
+struct S {
+ char a[4], char b[4];
+} __attribute_
ahatanak created this revision.
ahatanak added reviewers: rsmith, george.burgess.iv, aaron.ballman.
ahatanak added subscribers: cfe-commits, dexonsmith, hfinkel.
This patch adds support for attribute "overallocated", which will be used to
indicate a union or struct is over-allocated. This is need
26 matches
Mail list logo