[llvm-dev] LLVM type.h question

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Sun May 3 16:06:06 PDT 2020


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


More information about the llvm-dev mailing list