From 6309737da76f583f217c393dc8008f193e196975 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 5 Oct 2010 14:55:45 +0000 Subject: [PATCH] Register the __builtin_va_list_type node when we parse it, rather than waiting until we think we need it: we didn't catch all of the places where we actually needed it, and we probably wouldn't ever. Fixes a C++ PCH crasher. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115617 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Index/c-index-api-loadTU-test.m | 2 +- test/PCH/Inputs/va_arg.h | 2 ++ test/PCH/va_arg.cpp | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/PCH/Inputs/va_arg.h create mode 100644 test/PCH/va_arg.cpp diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index f34593f3e8..2176ea2152 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -28,7 +28,7 @@ @protocol SubP - spMethod; -@end +@endxb @interface Baz : Bar { diff --git a/test/PCH/Inputs/va_arg.h b/test/PCH/Inputs/va_arg.h new file mode 100644 index 0000000000..1244e9faa3 --- /dev/null +++ b/test/PCH/Inputs/va_arg.h @@ -0,0 +1,2 @@ +#include + diff --git a/test/PCH/va_arg.cpp b/test/PCH/va_arg.cpp new file mode 100644 index 0000000000..7c8dc6b316 --- /dev/null +++ b/test/PCH/va_arg.cpp @@ -0,0 +1,16 @@ +// Test this without pch. +// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/Inputs/va_arg.h %s -emit-llvm -o - + +// Test with pch. +// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -x c++-header -o %t %S/Inputs/va_arg.h +// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - + +typedef __SIZE_TYPE__ size_t; + +extern "C" { +int vsnprintf(char * , size_t, const char * , va_list) ; +} + +void f(char *buffer, unsigned count, const char* format, va_list argptr) { + vsnprintf(buffer, count, format, argptr); +} -- 2.40.0