r241577 - Changing a use of alignof() into llvm::alignOf() for MSVC compatibility. This requires changing a static_assert into an assert, too.

Richard Smith richard at metafoo.co.uk
Tue Jul 7 10:02:10 PDT 2015


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.

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150707/7527b511/attachment.html>


More information about the cfe-commits mailing list