Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-11-13 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: include/clang/AST/Expr.h:631-634 @@ -630,1 +630,6 @@ + /// tryEvaluateObjectSize - If the current Expr is a pointer, this will try to + /// statically determine how many bytes remain in the object this pointer is + ///

[PATCH] D14274: Add alloc_size attribute to clang

2015-11-02 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. This is the first in a two patch series aimed at adding the alloc_size attribute to clang. This patch adds the alloc_size attribute, docs, and all of the logic

Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-10-20 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 37935. george.burgess.iv added a comment. Rebased http://reviews.llvm.org/D13263 Files: include/clang/AST/Expr.h include/clang/AST/Type.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td

Re: [PATCH] D13704: [Fix] Allow implicit conversions of the address of overloadable functions in C + docs update

2015-10-20 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 37965. george.burgess.iv added a comment. Rebased http://reviews.llvm.org/D13704 Files: include/clang/Basic/AttrDocs.td lib/Sema/SemaOverload.cpp test/CodeGen/overloadable.c test/Sema/overloadable.c Index: test/Sema/overloadable.c

Re: [PATCH] D13871: Add modernize-use-default check to clang-tidy.

2015-10-19 Thread George Burgess IV via cfe-commits
george.burgess.iv added a subscriber: george.burgess.iv. george.burgess.iv added a comment. This looks like a good check -- thanks for adding it! Just one small nit for you. Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:19 @@ +18,3 @@ + +const char CtorDtor[] =

[PATCH] D13795: Prefer functions with true enable_if conditions when attempting to resolve the address of an overload

2015-10-15 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. Our overload resolution logic considers some candidate A better than some candidate B if the set of A's enable_if conditions is a strict superset of the set of

Re: [PATCH] D13795: Prefer functions with true enable_if conditions when attempting to resolve the address of an overload

2015-10-15 Thread George Burgess IV via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL250486: [Sema] Fix address-of + enable_if overloading logic (authored by gbiv). Changed prior to commit: http://reviews.llvm.org/D13795?vs=37545=37552#toc Repository: rL LLVM

r250488 - Make __builtin_object_size more conservative

2015-10-15 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Thu Oct 15 20:49:01 2015 New Revision: 250488 URL: http://llvm.org/viewvc/llvm-project?rev=250488=rev Log: Make __builtin_object_size more conservative r246877 made __builtin_object_size substantially more aggressive with unknown bases if Type=1 or Type=3, which causes issues

[PATCH] D13704: [Fix] Allow implicit conversions of the address of overloadable functions in C + docs update

2015-10-13 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. Two smallish patches in one. Happy to split into two (for review and/or commit) if that's preferred. In C, we allow (as an extension) incompatible pointer

[PATCH] D13664: [Fix] Don't emit multiple diagnostics for the same error

2015-10-12 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. Given code like the following (stolen from tests): ``` template int f(T1 *, const T2 *); template int f(const T1 *, T2 *); int (*p)(const int *, const int *)

Re: [PATCH] D13664: [Fix] Don't emit multiple diagnostics for the same error

2015-10-12 Thread George Burgess IV via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL250078: [Sema] Don't emit multiple diags for one error (authored by gbiv). Changed prior to commit: http://reviews.llvm.org/D13664?vs=37137=37138#toc Repository: rL LLVM

r250078 - [Sema] Don't emit multiple diags for one error

2015-10-12 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Mon Oct 12 13:40:58 2015 New Revision: 250078 URL: http://llvm.org/viewvc/llvm-project?rev=250078=rev Log: [Sema] Don't emit multiple diags for one error Fixed a bug where we'd emit multiple diagnostics if there was a problem taking the address of an overloaded template

r250090 - [Sema] Make `_with_enable_if_attrs` an error

2015-10-12 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Mon Oct 12 14:57:04 2015 New Revision: 250090 URL: http://llvm.org/viewvc/llvm-project?rev=250090=rev Log: [Sema] Make `_with_enable_if_attrs` an error This fixes a bug where one can take the address of a conditionally enabled function to drop its enable_if guards. For

Re: [PATCH] D13607: [Fix] Make it an error to take the address of (most) enable_if functions.

2015-10-12 Thread George Burgess IV via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL250090: [Sema] Make `_with_enable_if_attrs` an error (authored by gbiv). Changed prior to commit: http://reviews.llvm.org/D13607?vs=37075=37152#toc Repository: rL LLVM

r249995 - [Sema] Allow C conversions in C overload logic

2015-10-11 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Sun Oct 11 15:13:20 2015 New Revision: 249995 URL: http://llvm.org/viewvc/llvm-project?rev=249995=rev Log: [Sema] Allow C conversions in C overload logic C allows for some implicit conversions that C++ does not, e.g. void* -> char*. This patch teaches clang that these

Re: [PATCH] D13604: Fix to allow C conversions on arguments passed to functions with __attribute__((overloadable)) in C

2015-10-11 Thread George Burgess IV via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL249995: [Sema] Allow C conversions in C overload logic (authored by gbiv). Changed prior to commit: http://reviews.llvm.org/D13604?vs=36986=37062#toc Repository: rL LLVM

r249997 - Fix warning caused by r249995

2015-10-11 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Sun Oct 11 15:37:14 2015 New Revision: 249997 URL: http://llvm.org/viewvc/llvm-project?rev=249997=rev Log: Fix warning caused by r249995 Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL:

Re: [PATCH] D13607: [Fix] Make it an error to take the address of (most) enable_if functions.

2015-10-11 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: lib/Sema/SemaInit.cpp:4978-4990 @@ -4977,1 +4977,15 @@ +// As an extension, C can have overloaded functions. We need to add the +// address resolution step. +if (Initializer->getType() == Context.OverloadTy) { +

[PATCH] D13604: Fix to allow C conversions on arguments passed to functions with __attribute__((overloadable)) in C

2015-10-09 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. The following is legal in C, and illegal in C++: ``` void *getPtr(); void foo(char *c); int main() { foo(getPtr()); } ``` Currently, we only allow C++

[PATCH] D13607: [Fix] Make it an error to take the address of (most) enable_if functions.

2015-10-09 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. For the following function: ``` int foo(int a) __attribute__((enable_if(a > 0, ā€œā€))); ``` The callee should be able to reasonably assume that `foo` will be

Re: [PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

2015-10-09 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 36972. george.burgess.iv marked 4 inline comments as done. george.burgess.iv added a comment. Addressed all feedback. Also, updated object-size tests to use CHECK-LABEL instead of CHECK, because yay Iā€™m learning how to do things properly.

Re: [PATCH] D13157: Teach -Wtautological-overlap-compare about enums

2015-10-01 Thread George Burgess IV via cfe-commits
george.burgess.iv closed this revision. george.burgess.iv marked 4 inline comments as done. george.burgess.iv added a comment. Changed code to address all feedback + committed as r249053. Thanks for the reviews! Comment at: lib/Analysis/CFG.cpp:49 @@ +48,3 @@

r249053 - Teach -Wtautological-overlap-compare about enums

2015-10-01 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Thu Oct 1 13:47:52 2015 New Revision: 249053 URL: http://llvm.org/viewvc/llvm-project?rev=249053=rev Log: Teach -Wtautological-overlap-compare about enums Prior to this patch, -Wtautological-overlap-compare would only warn us if there was a sketchy logical comparison between

Re: [PATCH] D13157: Teach -Wtautological-overlap-compare about enums

2015-10-01 Thread George Burgess IV via cfe-commits
> Next time, add Differential Revision: to your commit and Phabricator will close the diff automatically. Ooh, shiny. Thanks for letting me know! > Doubling the expense for assert builds so that we get a slightly better stack trace in the event our assumptions are wrong doesn't seem like a good

[PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-09-29 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added subscribers: cfe-commits, rsmith. This was a fun patch :) This patch adds the parameter attribute `pass_object_size` to Clang. The design doc for this attribute is available here:

r248595 - Make incomplete type errors better with enable_if

2015-09-25 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Fri Sep 25 12:53:16 2015 New Revision: 248595 URL: http://llvm.org/viewvc/llvm-project?rev=248595=rev Log: Make incomplete type errors better with enable_if This patch fixes the order in which we evaluate the different ways that a function call could be disallowed. Now, if you

Re: [PATCH] D13157: Teach -Wtautological-overlap-compare about enums

2015-09-25 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: lib/Analysis/CFG.cpp:54 @@ +53,3 @@ +auto *DR = dyn_cast(E->IgnoreParenImpCasts()); +if (DR == nullptr) + return nullptr; aaron.ballman wrote: > Please don't compare a pointer against nullptr with

Re: [PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

2015-09-24 Thread George Burgess IV via cfe-commits
george.burgess.iv added a comment. Friendly ping :) http://reviews.llvm.org/D12821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D13157: Teach -Wtautological-overlap-compare about enums

2015-09-24 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rtrieu. george.burgess.iv added a subscriber: cfe-commits. Currently, -Wtautological-overlap-compare only emits warnings if the comparisons are between integer literals and variables. This patch adds support for

Re: [PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

2015-09-14 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 34710. george.burgess.iv marked 4 inline comments as done. george.burgess.iv added a comment. Addressed all feedback -- added a walk of the Designator as suggested. Regarding `isDesignatorAtObjectEnd`: I'm assuming that the Index returned by

Re: [PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

2015-09-14 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: lib/AST/ExprConstant.cpp:4457-4460 @@ -4434,1 +4456,6 @@ +// Because we set the Base to be the MemberExpr instead of E->getBase(), the +// Offset should be from the MemberExpr instead of the MemberExpr's base. +

Re: r246877 - Increase accuracy of __builtin_object_size.

2015-09-11 Thread George Burgess IV via cfe-commits
> 1) we lost track of the complete object, and > 2) the designator refers to the final subobject of the currently-known > complete object, and > 3) that subobject is either a flexible array member or an array of bound 0 > or 1. > > Then we'd leave it to IR generation to do the

[PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

2015-09-11 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added subscribers: cfe-commits, mzolotukhin. In C, a common idiom is: ``` struct Foo { int a; char cs[1] }; struct Foo *F = (struct Foo *)malloc(sizeof(Foo) + strlen(SomeString)); strcpy(F->cs,

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-09-04 Thread George Burgess IV via cfe-commits
george.burgess.iv closed this revision. george.burgess.iv marked 2 inline comments as done. george.burgess.iv added a comment. r246877. Thanks for the review! (Also: Forgot to submit comments with the most recent revision, so you're getting them all now. Sorry. :) ) Comment

r246890 - Fix a bug in __builtin_object_size cast removal

2015-09-04 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Fri Sep 4 17:36:18 2015 New Revision: 246890 URL: http://llvm.org/viewvc/llvm-project?rev=246890=rev Log: Fix a bug in __builtin_object_size cast removal Apparently there are many cast kinds that may cause implicit pointer arithmetic to happen. In light of this, the cast

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-09-02 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 33875. george.burgess.iv marked 16 inline comments as done. george.burgess.iv added a comment. Addressed all feedback; backed out support for more questionable features (negative indices, non-object-boundary offsets, etc), added logic to ignore

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-25 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 33104. george.burgess.iv added a comment. Talked with Richard, and we both agree that adding 4 EvaluationModes is too much for the use case. So, we decided to add a flag to LValue to denote that the LValueBase is invalid. This allows us to get by

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-20 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: lib/AST/ExprConstant.cpp:4763 @@ +4762,3 @@ + /// arithmetic. + bool UseStrictCastingRules; + rsmith wrote: This should be handled as an `EvaluationMode`. Works for me. Comment at:

[PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-19 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a reviewer: rsmith. george.burgess.iv added a subscriber: cfe-commits. (Hoping the formatting works as one would expect) Motivating examples: Pre-patch: ``` __builtin_object_size((char*)foo, 0) != __builtin_object_size(foo, 0) //

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-19 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 32662. george.burgess.iv added a comment. Removed advanced debugging tools (iostream) http://reviews.llvm.org/D12169 Files: lib/AST/ExprConstant.cpp test/CXX/expr/expr.const/p2-0x.cpp test/CodeGen/object-size.c Index:

r245323 - Make __builtin_object_size always answer correctly

2015-08-18 Thread George Burgess IV via cfe-commits
Author: gbiv Date: Tue Aug 18 13:18:27 2015 New Revision: 245323 URL: http://llvm.org/viewvc/llvm-project?rev=245323view=rev Log: Make __builtin_object_size always answer correctly __builtin_object_size would return incorrect answers for many uses where type=3. This fixes the inaccuracy by

Re: [PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

2015-08-18 Thread George Burgess IV via cfe-commits
george.burgess.iv closed this revision. george.burgess.iv added a comment. r245323 http://reviews.llvm.org/D12000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

2015-08-17 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments. Comment at: lib/AST/ExprConstant.cpp:6221-6223 @@ +6220,5 @@ + // + // extern struct X { char buff[32]; int a, b, c; } *p; + // int a = __builtin_object_size(p-buff + 4, 3); // returns 28 + // int b = __builtin_object_size(p-buff

Re: [PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

2015-08-17 Thread George Burgess IV via cfe-commits
george.burgess.iv updated the summary for this revision. george.burgess.iv updated this revision to Diff 32333. george.burgess.iv marked an inline comment as done. george.burgess.iv added a comment. Addressed feedback. http://reviews.llvm.org/D12000 Files: lib/AST/ExprConstant.cpp

[PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

2015-08-12 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision. george.burgess.iv added a subscriber: cfe-commits. Attached is a fix for https://llvm.org/bugs/show_bug.cgi?id=15212 . Summary: Tighten up some of the results for __builtin_object_size(ptr, type) when given type == 1 or type == 3 + fixed a bug where we

<    1   2   3   4