Currently, there are multiple places that need the values for sizeof/alignof/offsetof (at least two places in isIntegerConstantExpr and the visitor methods in CGExprScalar.cpp). However, there is no common method to compute the needed information. There really should be common methods (probably in ASTContext?) to get the result of evaluating these expressions, because the logic isn't trivial.
Sound reasonable? The reason I came upon this is that sizeof(void) currently crashes, and there are currently three places that have to be changed to get it right. Implementation notes: The two versions in isIntegerConstantExpr for sizeof/alignof (which appear to be the same) look mostly correct, although they don't handle sizeof(void) correctly... the version in CGExprScalar.cpp also mishandles "sizeof(void ())" (and a theoretical arch where CHAR_BIT != 8...). Also, ASTContext::getTypeInfo currently mishandles references in order to get the sizeof case correct, so once an alternative exists, that should be fixed. -Eli _______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
