[cfe-commits] r44684 - /cfe/trunk/Sema/SemaDecl.cpp

Steve Naroff snaroff at apple.com
Fri Dec 7 13:12:53 PST 2007


Author: snaroff
Date: Fri Dec  7 15:12:53 2007
New Revision: 44684

URL: http://llvm.org/viewvc/llvm-project?rev=44684&view=rev
Log:

Have Sema::CheckConstantInitList skip semantic analysis when the element type is a record (until we implement the FIXME). This removes a bogus error for the following code...

snarofflocal% cat bug.m

#import <Foundation/NSGeometry.h>

#define NUMHELICOPTERRECTS 5

static NSRect helicopterRects[NUMHELICOPTERRECTS] = {
    {{27, 0}, {18, 11}},	// Bottom
    {{0, 8}, {4, 11}},		// Tail
    {{0, 16}, {50, 1}},
    {{22, 5}, {18, 12}},	// Body
    {{0, 10}, {42, 3}}
};


Modified:
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44684&r1=44683&r2=44684&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Fri Dec  7 15:12:53 2007
@@ -453,6 +453,9 @@
   int maxElementsAtThisLevel = 0;
   int nInitsAtLevel = 0;
 
+  if (ElementType->isRecordType()) // FIXME: until we support structures...
+    return;
+    
   if (const ConstantArrayType *CAT = DeclType->getAsConstantArrayType()) {
     // We have a constant array type, compute maxElements *at this level*.
     maxElementsAtThisLevel = CAT->getMaximumElements();





More information about the cfe-commits mailing list