summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-28 18:58:38 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-28 18:58:38 +0000
commitc379c072405f39bca1d3552408fc0427328e8b6d (patch)
tree85495f4670e01e5f8e3948ca7c4fdedfbc1cb119 /clang/test
parent74c95e20af4838152a63010292d1063835176711 (diff)
downloadbcm5719-llvm-c379c072405f39bca1d3552408fc0427328e8b6d.tar.gz
bcm5719-llvm-c379c072405f39bca1d3552408fc0427328e8b6d.zip
Allow some differences between the predefines buffer used to build a
PCH file and the predefines buffer used when including the PCH file. We (explicitly) detect conflicting macro definitions (rejecting the PCH file) and about missing macro definitions (they'll be automatically pulled from the PCH file anyway). We're missing some checking to make sure that new macro definitions won't have any impact on the PCH file itself (e.g., #define'ing an identifier that the PCH file used). llvm-svn: 70316
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/PCH/fuzzy-pch.c17
-rw-r--r--clang/test/PCH/fuzzy-pch.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/PCH/fuzzy-pch.c b/clang/test/PCH/fuzzy-pch.c
new file mode 100644
index 00000000000..ce4634d756b
--- /dev/null
+++ b/clang/test/PCH/fuzzy-pch.c
@@ -0,0 +1,17 @@
+// Test with pch.
+// RUN: clang-cc -emit-pch -DFOO -o %t %S/variables.h &&
+// RUN: clang-cc -DBAR=int -include-pch %t -fsyntax-only -pedantic %s
+
+BAR bar = 17;
+
+#ifndef FOO
+# error FOO was not defined
+#endif
+
+#if FOO != 1
+# error FOO has the wrong definition
+#endif
+
+#ifndef BAR
+# error BAR was not defined
+#endif
diff --git a/clang/test/PCH/fuzzy-pch.h b/clang/test/PCH/fuzzy-pch.h
new file mode 100644
index 00000000000..9eb1005ce44
--- /dev/null
+++ b/clang/test/PCH/fuzzy-pch.h
@@ -0,0 +1,2 @@
+// Header for PCH test fuzzy-pch.c
+void f(int X);
OpenPOWER on IntegriCloud