summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/offsetof.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-02-27 06:44:11 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-02-27 06:44:11 +0000
commit988a16b9b842b23f98d6df0b9141bcd4462fdfd8 (patch)
treeda7ee827155adfbe84a388d67a79a2c3a235e2ae /clang/test/Sema/offsetof.c
parent34709f84d809133654f78b8de87573e74b619b5c (diff)
downloadbcm5719-llvm-988a16b9b842b23f98d6df0b9141bcd4462fdfd8.tar.gz
bcm5719-llvm-988a16b9b842b23f98d6df0b9141bcd4462fdfd8.zip
Change the AST generated for offsetof a bit so that it looks like a
normal expression, and change Evaluate and IRGen to evaluate it like a normal expression. This simplifies the code significantly, and fixes PR3396. llvm-svn: 65622
Diffstat (limited to 'clang/test/Sema/offsetof.c')
-rw-r--r--clang/test/Sema/offsetof.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/offsetof.c b/clang/test/Sema/offsetof.c
index 5fd2a30eb7e..0d33b775519 100644
--- a/clang/test/Sema/offsetof.c
+++ b/clang/test/Sema/offsetof.c
@@ -35,3 +35,13 @@ int v2 = (int)(&((struct s2 *) 0)->a) == 0 ? 0 : f();
struct s3 { int a; };
int v3 = __builtin_offsetof(struct s3, a) == 0 ? 0 : f();
+
+// PR3396
+struct sockaddr_un {
+ unsigned char sun_len;
+ char sun_path[104];
+};
+int a(int len) {
+int a[__builtin_offsetof(struct sockaddr_un, sun_path[len+1])];
+}
+
OpenPOWER on IntegriCloud