C++: Work around lack of size for enum type

This commit is contained in:
Dave Bartolomeo
2019-02-12 16:44:55 -08:00
parent 26525fc1b5
commit 055485d9eb

View File

@@ -16,6 +16,13 @@ class Enum extends UserType, IntegralOrEnumType {
*/
override string explain() { result = "enum " + this.getName() }
override int getSize() {
// Workaround for extractor bug CPP-348: No size information for enums.
// If the extractor didn't provide a size, assume four bytes.
result = UserType.super.getSize() or
not exists(UserType.super.getSize()) and result = 4
}
/** See `Type.isDeeplyConst` and `Type.isDeeplyConstBelow`. Internal. */
override predicate isDeeplyConstBelow() { any() } // No subparts