[cfe-dev] Is APSIntType generally useful?

Jordy Rose jediknil at belkadan.com
Mon May 7 21:04:54 PDT 2012

Hi, cfe-dev. As part of a reworking of the analyzer's constraint system, I came up with what I think is a useful abstraction of an integer type: APSIntType. This appears in r156360 and r156361, and is useful when dealing with mixed-type integer constants.

Does anyone think this would be useful outside of the analyzer? A quick search finds a few other places where APSInts are being converted and the bit width and the signedness are being passed around separately, which was the original motivation for this. (The other major use case is seeing if a value is representable /before/ converting it.)

APSIntType only depends on llvm::APSInt, so it could conceivably go all the way down in LLVM/ADT. The one extension is getting an APSIntType from a QualType, which currently lives on the analyzer's BasicValueFactory, but that's something that could easily live on ASTContext itself, either replacing or alongside MakeIntValue.


P.S. Anyone have a better name? "Type" is a bit overloaded already.

More information about the cfe-dev mailing list