[cfe-dev] Static Assertions inside VarDecl constructor

Amila Jayasekara thejaka.amila at gmail.com
Thu Jun 4 19:08:45 PDT 2015


Thank you Reid and David.

I will probably use David's approach in my code (3.6 based) and incorporate
new bit fields.

Regards
-Thejaka

On Thu, Jun 4, 2015 at 8:31 PM, David Majnemer <david.majnemer at gmail.com>
wrote:

>
>
> On Tue, Jun 2, 2015 at 9:24 AM, Amila Jayasekara <thejaka.amila at gmail.com>
> wrote:
>
>> Hello,
>>
>> Inside VarDecl constructor (Decl.cpp L1721 in Clang 3.6) there are 2
>> static assertions as follows;
>>
>> VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,...) {
>>
>>   static_assert(sizeof(VarDeclBitfields) <= sizeof(unsigned),
>>           "VarDeclBitfields too large!");
>>   static_assert(sizeof(ParmVarDeclBitfields) <= sizeof(unsigned),
>>           "ParmVarDeclBitfields too large!");
>>   ...
>> }
>>
>> I am trying to add an another field to VarDeclBitfields and it triggers
>> second static assertion in above code.
>>
>
> I made more room in r237648:
> http://llvm.org/viewvc/llvm-project?view=revision&revision=237648
>
>
>>
>> Could you please explain why sizeof VarDeclBitfields and
>> ParmVarDeclBitfields must be less than sizeof(unsigned) and also what are
>> repercussions if I remove above assertions ?
>>
>> Thanks
>> -Thejaka
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150604/91c1a7fa/attachment.html>


More information about the cfe-dev mailing list