]> granicus.if.org Git - clang/commitdiff
Register the __builtin_va_list_type node when we parse it, rather than
authorDouglas Gregor <dgregor@apple.com>
Tue, 5 Oct 2010 14:55:45 +0000 (14:55 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 5 Oct 2010 14:55:45 +0000 (14:55 +0000)
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
test/PCH/Inputs/va_arg.h [new file with mode: 0644]
test/PCH/va_arg.cpp [new file with mode: 0644]

index f34593f3e85ec8450aefcb785ec457e0020a1e7c..2176ea21525499740176428f4f8920e6964be82f 100644 (file)
@@ -28,7 +28,7 @@
 
 @protocol SubP <Proto>
 - spMethod;
-@end
+@endxb
 
 @interface Baz : Bar <SubP>
 {
diff --git a/test/PCH/Inputs/va_arg.h b/test/PCH/Inputs/va_arg.h
new file mode 100644 (file)
index 0000000..1244e9f
--- /dev/null
@@ -0,0 +1,2 @@
+#include <stdarg.h>
+
diff --git a/test/PCH/va_arg.cpp b/test/PCH/va_arg.cpp
new file mode 100644 (file)
index 0000000..7c8dc6b
--- /dev/null
@@ -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);
+}