summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-09-05 20:24:27 +0000
committerBen Langmuir <blangmuir@apple.com>2014-09-05 20:24:27 +0000
commitbb1c918ec85f24457a4aeb47a08683df34063916 (patch)
treec6ca2d5f22be9df55f512ed6f0f7555ab825d101 /clang/test
parent7ec2cb2fda0d3fbc88ff6b1e9bc98cbfc67fb29c (diff)
downloadbcm5719-llvm-bb1c918ec85f24457a4aeb47a08683df34063916.tar.gz
bcm5719-llvm-bb1c918ec85f24457a4aeb47a08683df34063916.zip
Move the initialization of VAListTagName after InitializeSema()
This innocuous statement to get the identifier info for __va_list_tag was causing an assertion failure: NextIsPrevious() && "decl became non-canonical unexpectedly" if the __va_list_tag identifier was found in a PCH in some circumstances, because it was looked up before the ASTReader had a Sema object to use to find existing decls to merge with. We could possibly move getting the identifier info even later, or make it lazy if we wanted to, but this seemed like the minimal change. Now why a PCH would have this identifier in the first place is a bit mysterious. This seems to be related to the global module index in some way, because when the test case is built without the global module index it will not emit an identifier for __va_list_tag into the PCH, but with the global module index it does. llvm-svn: 217275
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/va_list/module.modulemap5
-rw-r--r--clang/test/Modules/Inputs/va_list/va_list_a.h2
-rw-r--r--clang/test/Modules/Inputs/va_list/va_list_b.h2
-rw-r--r--clang/test/Modules/va_list.m27
4 files changed, 36 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/va_list/module.modulemap b/clang/test/Modules/Inputs/va_list/module.modulemap
new file mode 100644
index 00000000000..a1a6f7d4e07
--- /dev/null
+++ b/clang/test/Modules/Inputs/va_list/module.modulemap
@@ -0,0 +1,5 @@
+module stdarg [system] {
+ header "stdarg.h" // note: supplied by the compiler
+}
+module va_list_a { header "va_list_a.h" }
+module va_list_b { header "va_list_b.h" }
diff --git a/clang/test/Modules/Inputs/va_list/va_list_a.h b/clang/test/Modules/Inputs/va_list/va_list_a.h
new file mode 100644
index 00000000000..c1e0f978184
--- /dev/null
+++ b/clang/test/Modules/Inputs/va_list/va_list_a.h
@@ -0,0 +1,2 @@
+@import stdarg;
+int vprintf(const char * __restrict, va_list);
diff --git a/clang/test/Modules/Inputs/va_list/va_list_b.h b/clang/test/Modules/Inputs/va_list/va_list_b.h
new file mode 100644
index 00000000000..b7f9b3d367c
--- /dev/null
+++ b/clang/test/Modules/Inputs/va_list/va_list_b.h
@@ -0,0 +1,2 @@
+@import va_list_a;
+void NSLogv(id, va_list);
diff --git a/clang/test/Modules/va_list.m b/clang/test/Modules/va_list.m
new file mode 100644
index 00000000000..5a305180fcf
--- /dev/null
+++ b/clang/test/Modules/va_list.m
@@ -0,0 +1,27 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \
+// RUN: -fmodules-ignore-macro=PREFIX -DPREFIX -I %S/Inputs/va_list \
+// RUN: -x objective-c-header %s -o %t.pch -emit-pch
+
+// Include the pch, as a sanity check.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \
+// RUN: -fmodules-ignore-macro=PREFIX -I %S/Inputs/va_list -include-pch %t.pch \
+// RUN: -x objective-c %s -fsyntax-only
+
+// Repeat the previous emit-pch, but not we will have a global module index.
+// For some reason, this results in an identifier for __va_list_tag being
+// emitted into the pch.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \
+// RUN: -fmodules-ignore-macro=PREFIX -DPREFIX -I %S/Inputs/va_list \
+// RUN: -x objective-c-header %s -o %t.pch -emit-pch
+
+// Include the pch, which now has __va_list_tag in it, which needs to be merged.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \
+// RUN: -fmodules-ignore-macro=PREFIX -I %S/Inputs/va_list -include-pch %t.pch \
+// RUN: -x objective-c %s -fsyntax-only
+
+// rdar://18039719
+
+#ifdef PREFIX
+@import va_list_b;
+#endif
OpenPOWER on IntegriCloud