r241577 - Changing a use of alignof() into llvm::alignOf() for MSVC compatibility. This requires changing a static_assert into an assert, too.
Aaron Ballman
aaron at aaronballman.com
Tue Jul 7 10:12:46 PDT 2015
On Tue, Jul 7, 2015 at 1:02 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On 7 Jul 2015 5:53 am, "Aaron Ballman" <aaron at aaronballman.com> wrote:
>>
>> Author: aaronballman
>> Date: Tue Jul 7 07:50:30 2015
>> New Revision: 241577
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=241577&view=rev
>> Log:
>> Changing a use of alignof() into llvm::alignOf() for MSVC compatibility.
>> This requires changing a static_assert into an assert, too.
>
> You can use AlignOf instead of alignOf to keep the assert static.
Excellent point; r241604 makes this change.
Thanks!
~Aaron
>
>> Modified:
>> cfe/trunk/lib/AST/DeclObjC.cpp
>>
>> Modified: cfe/trunk/lib/AST/DeclObjC.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=241577&r1=241576&r2=241577&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/AST/DeclObjC.cpp (original)
>> +++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Jul 7 07:50:30 2015
>> @@ -1266,8 +1266,9 @@ ObjCTypeParamList *ObjCTypeParamList::cr
>> SourceLocation rAngleLoc) {
>> unsigned size = sizeof(ObjCTypeParamList)
>> + sizeof(ObjCTypeParamDecl *) * typeParams.size();
>> - static_assert(alignof(ObjCTypeParamList) >=
>> alignof(ObjCTypeParamDecl*),
>> - "type parameter list needs greater alignment");
>> + assert(llvm::alignOf<ObjCTypeParamList>() >=
>> + llvm::alignOf<ObjCTypeParamDecl *>() &&
>> + "type parameter list needs greater alignment");
>> unsigned align = llvm::alignOf<ObjCTypeParamList>();
>> void *mem = ctx.Allocate(size, align);
>> return new (mem) ObjCTypeParamList(lAngleLoc, typeParams, rAngleLoc);
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list