r341539 - [OpenCL] Disallow negative attribute arguments

Andrew Savonichev via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 6 07:00:48 PDT 2018


Hi Aaron,

> On Thu, Sep 6, 2018 at 7:54 AM, Andrew Savonichev via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>> Author: asavonic
>> Date: Thu Sep  6 04:54:09 2018
>> New Revision: 341539
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=341539&view=rev
>> Log:
>> [OpenCL] Disallow negative attribute arguments
>>
>> [...]
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=341539&r1=341538&r2=341539&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep  6 04:54:09 2018
>> @@ -2529,6 +2529,8 @@ def err_attribute_argument_type : Error<
>>    "constant|a string|an identifier}1">;
>>  def err_attribute_argument_outof_range : Error<
>>    "%0 attribute requires integer constant between %1 and %2 inclusive">;
>> +def err_attribute_argument_negative : Error<
>> +  "negative argument is not allowed for %0 attribute">;
>
> I don't think we need a new diagnostic here as we already have
> err_attribute_requires_positive_integer.

`err_attribute_requires_positive_integer' implies that a zero argument
is not allowed, while `err_attribute_argument_negative' should fire only
on a strictly negative argument.

I can merge these diagnostics into one (using %select), but I'm not sure
if it is appropriate.

-- 
Andrew

--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the cfe-commits mailing list