Right - this is intended to catch a problem where someone tries to store a value
in SubclassData that is too large to fit in the bitfield.
-Chris
> On May 3, 2020, at 4:45 PM, Craig Topper via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>
> Isn't the SubclassData member a 24 bit bitfield? I think the truncation
would happen on the assignment to it.
>
> ~Craig
>
>
> On Sun, May 3, 2020 at 4:06 PM James Courtier-Dutton via llvm-dev
<llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>
wrote:
> Hi,
>
> I see this in the Type class:
>
> unsigned getSubclassData() const { return SubclassData; }
>
> void setSubclassData(unsigned val) {
> SubclassData = val;
> // Ensure we don't have any accidental truncation.
> assert(getSubclassData() == val && "Subclass data too large
for field");
> }
>
> How will the assert ever get triggered?
> The type is "unsigned" so how can getSubclassData() ever not
equal val ?
> Where does the truncation take place?
>
> Kind Regards
>
> James
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
<https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20200504/bb42fe9d/attachment.html>