-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Bugzilla Link | 3521 |
Resolution | FIXED |
Resolved on | Mar 12, 2010 00:57 |
Version | unspecified |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @DougGregor,@efriedma-quic |
Extended Description
Sema currently has some extra code for accepting static initializers which is not present in Evaluate. As a consequence, isConstantInitializer returns false for things which Sema has accepted as constant initializers.
This causes problems for CodeGen, which should not have to replicate this code.
For example, replacing calls to CheckConstantInitializer with:
if (!CheckForConstantInitializer(Init, DclT))
assert(Init->isConstantInitializer(Context) && "Invalid CheckForConstantInitializer result.");
results in 10 assertions just when running the clang test suite.
We need a number of cleanups here:
-
Decl's should distinguish between constant and non-constant initializers (C++).
-
The special Sema code for accepting more things as constant initializers needs to be killed off and moved into Evaluate.
-
CodeGen should stop doing any more work than is necessary to emit constant initializers. The constant emission should only worry about walking the initializer tree, but not about actually constructing values for things; it should rely on Evaluate for that.
This bug is a placeholder for this work.