From: Douglas Gregor Date: Fri, 17 Apr 2009 20:06:59 +0000 (+0000) Subject: PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDe... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7dac085f82d2cf395950db137f0bbf00fb305a8;p=clang PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDeclRefExpr git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69376 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 2e8e7dd287..8889312090 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -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 index 0000000000..796be03b07 --- /dev/null +++ b/test/PCH/va_arg.c @@ -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 index 0000000000..4a8e5102bc --- /dev/null +++ b/test/PCH/va_arg.h @@ -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)); +}