]> granicus.if.org Git - clang/commitdiff
PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDe...
authorDouglas Gregor <dgregor@apple.com>
Fri, 17 Apr 2009 20:06:59 +0000 (20:06 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 17 Apr 2009 20:06:59 +0000 (20:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69376 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReader.cpp
test/PCH/va_arg.c [new file with mode: 0644]
test/PCH/va_arg.h [new file with mode: 0644]

index 2e8e7dd287d5d45157e2c755d6f3d621ce5e816a..8889312090eca34f81f16df873f35b5252f60dc0 100644 (file)
@@ -2369,7 +2369,6 @@ Stmt *PCHReader::ReadStmt() {
       break;
 
     case pch::EXPR_VA_ARG:
-      // FIXME: untested; we need function bodies first
       S = new (Context) VAArgExpr(Empty);
       break;
 
@@ -2402,7 +2401,6 @@ Stmt *PCHReader::ReadStmt() {
       break;
 
     case pch::EXPR_BLOCK_DECL_REF:
-      // FIXME: untested until we have statement and block support
       S = new (Context) BlockDeclRefExpr(Empty);
       break;
     }
diff --git a/test/PCH/va_arg.c b/test/PCH/va_arg.c
new file mode 100644 (file)
index 0000000..796be03
--- /dev/null
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h -fsyntax-only -ast-print -o - %s
+
+// Test with pch.
+// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h &&
+// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t -fsyntax-only -ast-print -o - %s 
+
+char *g0(char** argv, int argc) { return argv[argc]; }
+
+char *g(char **argv) {
+  f(g0, argv, 1, 2, 3);
+}
diff --git a/test/PCH/va_arg.h b/test/PCH/va_arg.h
new file mode 100644 (file)
index 0000000..4a8e510
--- /dev/null
@@ -0,0 +1,8 @@
+// Header for PCH test va_arg.c
+
+typedef __builtin_va_list va_list;
+char *f (char * (*g) (char **, int), char **p, ...) {
+    char *s;
+    va_list v;
+    s = g (p, __builtin_va_arg(v, int));
+}