[PATCH] D31839: make -Winteger-overflow find overflows in function arguments

Nick Lewycky via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 17:32:49 PDT 2017


nlewycky added a comment.

In https://reviews.llvm.org/D31839#722763, @ahatanak wrote:

> Is it possible to fix ObjCMessageExpr too while you are in here?


I looked into this, but it turns out to be different enough to belong in a separate patch. An ObjCMessageExpr has void type which means that we bail very early in the expression evaluator since void isn't a literal type. I think the original design of the code was to turn an Expr* into an APValue, and as we push it past that original purpose we're going to need to restructure it a bit.

> I think clang should issue a warning when compiling the following code:
> 
>   @protocol NSObject
>   @end
>   
>   @interface NSObject<NSObject>
>   @end
>   
>   @interface C1 : NSObject
>   - (void)foo:(int)i;
>   @end
>   @implementation C1
>   - (void)foo:(int)i {
>   }
>   @end
>   
>   void test1(C1 *c) {
>     [c foo:(4068 * 1024 * 1024)];
>   }




https://reviews.llvm.org/D31839





More information about the cfe-commits mailing list