[LLVMbugs] [Bug 3521] New: Handling of constant initializers needs cleaning

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Feb 9 13:06:29 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=3521

           Summary: Handling of constant initializers needs cleaning
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


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:
1. Decl's should distinguish between constant and non-constant initializers
(C++).

2. The special Sema code for accepting more things as constant initializers
needs to be killed off and moved into Evaluate.

3. 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.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list