summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
commit4c8b24812ddcd1dedaca343a6d4e76f91f398981 (patch)
tree137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/PCH
parent5362a71c02e7d448a8ce98cf00c47e353fba5d04 (diff)
Notes
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx-method.cpp7
-rw-r--r--test/PCH/libroot/usr/include/reloc.h15
-rw-r--r--test/PCH/libroot/usr/include/reloc2.h15
-rw-r--r--test/PCH/method_pool.h3
-rw-r--r--test/PCH/objc_exprs.m5
-rw-r--r--test/PCH/pr4489.c22
-rw-r--r--test/PCH/reloc.c14
7 files changed, 75 insertions, 6 deletions
diff --git a/test/PCH/cxx-method.cpp b/test/PCH/cxx-method.cpp
new file mode 100644
index 000000000000..144406e7bdaf
--- /dev/null
+++ b/test/PCH/cxx-method.cpp
@@ -0,0 +1,7 @@
+// RUN: clang-cc -emit-pch %s -o %t
+
+struct S {
+ void m(int x);
+};
+
+void S::m(int x) { }
diff --git a/test/PCH/libroot/usr/include/reloc.h b/test/PCH/libroot/usr/include/reloc.h
new file mode 100644
index 000000000000..04eeacba8ff5
--- /dev/null
+++ b/test/PCH/libroot/usr/include/reloc.h
@@ -0,0 +1,15 @@
+#ifndef RELOC_H
+#define RELOC_H
+
+#include <reloc2.h>
+
+
+
+
+
+
+
+// Line number 13 below is important
+int x = 2;
+
+#endif // RELOC_H
diff --git a/test/PCH/libroot/usr/include/reloc2.h b/test/PCH/libroot/usr/include/reloc2.h
new file mode 100644
index 000000000000..995415ce95bc
--- /dev/null
+++ b/test/PCH/libroot/usr/include/reloc2.h
@@ -0,0 +1,15 @@
+#ifndef RELOC2_H
+#define RELOC2_H
+#include <stddef.h>
+
+
+
+
+
+
+
+
+
+// Line number below is important!
+int y = 2;
+#endif // RELOC2_H
diff --git a/test/PCH/method_pool.h b/test/PCH/method_pool.h
index f7af9044d92d..80858360d725 100644
--- a/test/PCH/method_pool.h
+++ b/test/PCH/method_pool.h
@@ -22,8 +22,7 @@
@end
@implementation TestMethodPool1
-+ alloc {
-}
++ alloc { return 0; }
- (double)instMethod:(int)foo {
return foo;
diff --git a/test/PCH/objc_exprs.m b/test/PCH/objc_exprs.m
index eb1ae434a7e0..48966f36f33a 100644
--- a/test/PCH/objc_exprs.m
+++ b/test/PCH/objc_exprs.m
@@ -6,7 +6,7 @@
// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s
// Expressions
-int *A1 = (objc_string)0; // expected-warning {{'struct objc_object *'}}
+int *A1 = (objc_string)0; // expected-warning {{aka 'id'}}
char A2 = (objc_encode){}; // expected-error {{not a compile-time constant}} \
expected-warning {{char [2]}}
@@ -15,8 +15,7 @@ int *A3 = (objc_protocol)0; // expected-warning {{aka 'Protocol *'}}
// Types.
-int *T0 = (objc_id_protocol_ty)0; // expected-error {{not a compile-time constant}} \
- expected-warning {{aka 'id<foo>'}}
+int *T0 = (objc_id_protocol_ty)0; // expected-warning {{aka 'id<foo>'}}
int *T1 = (objc_interface_ty)0; // expected-warning {{aka 'itf *'}}
int *T2 = (objc_qual_interface_ty)0; // expected-warning {{aka 'itf<foo> *'}}
diff --git a/test/PCH/pr4489.c b/test/PCH/pr4489.c
index 696da5bbb483..7730819e9213 100644
--- a/test/PCH/pr4489.c
+++ b/test/PCH/pr4489.c
@@ -1,7 +1,8 @@
// RUN: clang -x c-header -o %t.pch %s &&
// RUN: clang -include %t -x c /dev/null -emit-llvm -S -o -
// PR 4489: Crash with PCH
-
+// PR 4492: Crash with PCH (round two)
+// PR 4509: Crash with PCH (round three)
typedef struct _IO_FILE FILE;
extern int fprintf (struct _IO_FILE *__restrict __stream,
__const char *__restrict __format, ...);
@@ -17,4 +18,23 @@ int x(void)
void y(void) {
extern char z;
fprintf (0, "a");
+}
+
+struct y0 { int i; } y0[1] = {};
+
+void x0(void)
+{
+ extern char z0;
+ fprintf (0, "a");
+}
+
+void x1(void)
+{
+ fprintf (0, "asdf");
+}
+
+void y1(void)
+{
+ extern char e;
+ fprintf (0, "asdf");
} \ No newline at end of file
diff --git a/test/PCH/reloc.c b/test/PCH/reloc.c
new file mode 100644
index 000000000000..b08187fdb8d8
--- /dev/null
+++ b/test/PCH/reloc.c
@@ -0,0 +1,14 @@
+// RUN: clang-cc -emit-pch -o %t --relocatable-pch -isysroot %S/libroot %S/libroot/usr/include/reloc.h &&
+// RUN: clang-cc -include-pch %t -isysroot %S/libroot %s -verify &&
+// RUN: not clang-cc -include-pch %t %s
+
+#include <reloc.h>
+
+int x = 2; // expected-error{{redefinition}}
+int y = 5; // expected-error{{redefinition}}
+
+
+
+
+// expected-note{{previous definition}}
+// expected-note{{previous definition}}