[llvm-dev] LLVM type.h question

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Sun May 3 16:45:42 PDT 2020


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> 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
> 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/20200503/9b20d7a0/attachment.html>


More information about the llvm-dev mailing list