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
+ ///
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
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
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
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[] =
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
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
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
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
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 *)
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
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
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
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
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
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
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:
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) {
+
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++
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
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.
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 @@
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
> 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
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:
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
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
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
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
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
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.
+
> 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
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,
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
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
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
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
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:
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) //
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:
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
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
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
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
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
301 - 345 of 345 matches
Mail list logo