[PATCH] D21453: Add support for attribute "overallocated"

2016-12-12 Thread Akira Hatanaka via Phabricator via cfe-commits
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

[PATCH] D21453: Add support for attribute "overallocated"

2016-12-09 Thread Akira Hatanaka via Phabricator via cfe-commits
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

[PATCH] D21453: Add support for attribute "overallocated"

2016-12-08 Thread Akira Hatanaka via Phabricator via cfe-commits
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

[PATCH] D21453: Add support for attribute "overallocated"

2016-12-02 Thread Richard Smith via Phabricator via cfe-commits
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?

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-08-03 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-21 Thread Aaron Ballman via 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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-19 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-11 Thread Akira Hatanaka via 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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-11 Thread Akira Hatanaka via cfe-commits
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/

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-11 Thread Aaron Ballman via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-08 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-08 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-05 Thread Aaron Ballman via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-07-01 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-28 Thread Akira Hatanaka via cfe-commits
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 _

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-27 Thread Richard Smith via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-27 Thread Aaron Ballman via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-27 Thread Duncan P. N. Exon Smith via cfe-commits
> 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.

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-27 Thread Aaron Ballman via cfe-commits
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]; ---

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-23 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-20 Thread George Burgess IV via cfe-commits
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 ___

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-20 Thread Aaron Ballman via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-17 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-17 Thread Akira Hatanaka via cfe-commits
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

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-16 Thread Richard Smith via cfe-commits
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_

[PATCH] D21453: Add support for attribute "overallocated"

2016-06-16 Thread Akira Hatanaka via cfe-commits
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