Proposed patch adds TLS Max Alignment diagnostic
David Majnemer
david.majnemer at gmail.com
Fri Apr 3 15:48:20 PDT 2015
I think you want to do something similar to
Sema::CheckAlignasUnderalignment:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?revision=233261&view=markup#l2985
On Fri, Apr 3, 2015 at 3:21 PM, Li, Charles <charles_li at playstation.sony.com
> wrote:
> Hi David,
>
>
>
>
>
> Oops, we didn’t think of the case where the alignment could be a template
> parameter.
>
> I currently don’t have a clue to fix this.
>
> Any hint would be greatly welcome.
>
>
>
> On why we used BaseT instead of T.
>
> I think we originally added
>
> QualType BaseT = Context.getBaseElementType(T);
>
> Just be to conservative as we don’t fully understand how LLVM’s type
> system when it comes to templates.
>
> I have re-ran clang replacing BaseT with T and did not notice any
> regressions.
>
> So I will take out BaseT for the next revision of the patch.
>
>
>
>
>
> Cheers,
>
> Charles Li
>
>
>
>
>
> *From:* David Majnemer [mailto:david.majnemer at gmail.com]
> *Sent:* Wednesday, April 01, 2015 7:08 PM
> *To:* Li, Charles
> *Cc:* cfe-commits at cs.uiuc.edu
> *Subject:* Re: Proposed patch adds TLS Max Alignment diagnostic
>
>
>
> Hi Charles,
>
>
>
> Your patch doesn't handle cases where the alignment is dependent,
> getDeclAlign doesn't want to be called in such cases:
>
> template <int N>
>
> struct S {
>
> static int __thread __attribute__((aligned(N))) x;
>
> };
>
>
>
> Also, why do you use BaseT->isDependentType() instead of
> T->isDependentType()?
>
>
>
> On Wed, Apr 1, 2015 at 4:57 PM, Li, Charles <
> charles_li at playstation.sony.com> wrote:
>
> Hi Clang developers,
>
>
>
> We here at Sony PlayStation have a proposed patch which adds an error
> diagnostic for when TLS variables exceed maximum TLS alignment.
>
> Please note this patch does not affect normal maximum alignments.
>
> This TLS maximum alignment check is currently only turned on for PS4 but
> could potentially be used for other platforms.
>
>
>
> Sincerely,
>
> Charles Li
>
>
>
>
> _______________________________________________
> 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/20150403/163dfef5/attachment.html>
More information about the cfe-commits
mailing list