Change Expr::isIntegerConstantExpr() to allow for pointer types (for GCC compatibility). Note FIXME.

Fix <rdar://problem/5977870> clang on xcode: error: arrays with static storage duration must have constant integer length


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51907 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steve Naroff 2008-06-03 17:15:29 +00:00
Родитель 20373221ce
Коммит a2ac06e964
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -918,6 +918,11 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
if (!SubExpr->getType()->isArithmeticType() ||
!getType()->isIntegerType()) {
if (Loc) *Loc = SubExpr->getLocStart();
// GCC accepts pointers as an extension.
// FIXME: check getLangOptions().NoExtensions. At the moment, it doesn't
// appear possible to get langOptions() from the Expr.
if (SubExpr->getType()->isPointerType()) // && !NoExtensions
return true;
return false;
}

Просмотреть файл

@ -8,6 +8,12 @@ typedef struct _NSRange { } NSRange;
+ alloc;
- autorelease;
@end
// GCC allows pointer expressions in integer constant expressions.
struct {
char control[((int)(char *)2)];
} xx;
@implementation PBXDocBookmark // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'autorelease' not found}} expected-warning {{method definition for 'alloc' not found}}
+ (id)bookmarkWithFileReference:(PBXFileReference *)fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor