Fix for PR2910: implement CodeGen for non-constant offsetof.

Note that there are still other issues in this area; see PR3396.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/offsetof.c b/test/CodeGen/offsetof.c
new file mode 100644
index 0000000..7b6f503
--- /dev/null
+++ b/test/CodeGen/offsetof.c
@@ -0,0 +1,12 @@
+// RUN: clang %s -emit-llvm -o %t
+
+// PR2910
+struct sockaddr_un {
+ unsigned char sun_len;
+ char sun_path[104];
+};
+
+int test(int len) {
+  return __builtin_offsetof(struct sockaddr_un, sun_path[len+1]);
+}
+