summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/pch-with-errors.c
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-03-07 01:51:17 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-03-07 01:51:17 +0000
commit4a280ff48fd6194d5fe06df21b057d30af93a386 (patch)
tree2a904ffe7ce2cd1dcf1214b18eccd09cbe3ea5ab /clang/test/Index/pch-with-errors.c
parent9b2ab81a0c37d1adbf7924823ac923045a543eed (diff)
downloadbcm5719-llvm-4a280ff48fd6194d5fe06df21b057d30af93a386.tar.gz
bcm5719-llvm-4a280ff48fd6194d5fe06df21b057d30af93a386.zip
[PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
Diffstat (limited to 'clang/test/Index/pch-with-errors.c')
-rw-r--r--clang/test/Index/pch-with-errors.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Index/pch-with-errors.c b/clang/test/Index/pch-with-errors.c
new file mode 100644
index 00000000000..21cf32a0cbf
--- /dev/null
+++ b/clang/test/Index/pch-with-errors.c
@@ -0,0 +1,28 @@
+
+#ifndef HEADER
+#define HEADER
+
+void erroneous(int);
+void erroneous(float);
+
+#else
+
+void foo(void) {
+ erroneous(0);
+}
+
+#endif
+
+// RUN: c-index-test -write-pch %t.h.pch %s
+// RUN: c-index-test -test-load-source local %s -include %t.h | FileCheck -check-prefix=CHECK-PARSE %s
+// RUN: c-index-test -index-file %s -include %t.h | FileCheck -check-prefix=CHECK-INDEX %s
+
+// CHECK-PARSE: pch-with-errors.c:10:6: FunctionDecl=foo:10:6 (Definition) Extent=[10:1 - 12:2]
+// CHECK-PARSE: pch-with-errors.c:11:3: CallExpr=erroneous:5:6 Extent=[11:3 - 11:15]
+
+// CHECK-INDEX: [indexDeclaration]: kind: function | name: foo
+// CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous
+
+// RUN: %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s
+
+// PCH-ERR: error: PCH file contains compiler errors
OpenPOWER on IntegriCloud