Put back my temporary hack until Eli addresses this in a more complete fashion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steve Naroff 2008-06-03 22:06:04 +00:00
Родитель 0a8b4e3f7d
Коммит c793808539
2 изменённых файлов: 28 добавлений и 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;
}

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

@ -0,0 +1,23 @@
// RUN: clang -fsyntax-only -verify %s
typedef long unsigned int __darwin_size_t;
typedef long __darwin_ssize_t;
typedef __darwin_size_t size_t;
typedef __darwin_ssize_t ssize_t;
struct cmsghdr {};
#if 0
This code below comes from the following system headers:
sys/socket.h:#define CMSG_SPACE(l) (__DARWIN_ALIGN(sizeof(struct
cmsghdr)) + __DARWIN_ALIGN(l))
i386/_param.h:#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(p)
+ __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
#endif
ssize_t sendFileDescriptor(int fd, void *data, size_t nbytes, int sendfd) {
union {
char control[(((__darwin_size_t)((char *)(sizeof(struct cmsghdr)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)) + ((__darwin_size_t)((char *)(sizeof(int)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)))];
} control_un;
}