1// Note: the run lines follow their respective tests, since line/column 2// matter in this test. 3 4// pcherror-error@* {{PCH file contains compiler errors}} 5@import error; // notallowerror-error {{could not build module 'error'}} 6// expected-no-diagnostics 7 8void test(Error *x) { 9 [x method]; 10} 11 12// RUN: rm -rf %t 13// RUN: mkdir %t 14// RUN: mkdir %t/prebuilt 15 16// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \ 17// RUN: -fmodule-name=error -o %t/prebuilt/error.pcm \ 18// RUN: -x objective-c -emit-module %S/Inputs/error/module.modulemap 19 20// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \ 21// RUN: -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \ 22// RUN: -ast-print %s | FileCheck %s 23// RUN: %clang_cc1 -fsyntax-only -fmodules \ 24// RUN: -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \ 25// RUN: -verify=pcherror %s 26 27// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \ 28// RUN: -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \ 29// RUN: -ast-print %s | FileCheck %s 30// RUN: %clang_cc1 -fsyntax-only -fmodules \ 31// RUN: -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \ 32// RUN: -verify=pcherror %s 33 34// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \ 35// RUN: -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \ 36// RUN: -ast-print %s | FileCheck %s 37// RUN: not %clang_cc1 -fsyntax-only -fmodules \ 38// RUN: -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \ 39// RUN: -verify=pcherror %s 40 41// Shouldn't build the cached module (that has errors) when not allowing errors 42// RUN: not %clang_cc1 -fsyntax-only -fmodules \ 43// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \ 44// RUN: -x objective-c %s 45// RUN: find %t -name "error-*.pcm" | not grep error 46 47// Should build the cached module when allowing errors 48// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \ 49// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \ 50// RUN: -x objective-c -verify %s 51// RUN: find %t -name "error-*.pcm" | grep error 52 53// Make sure there is still an error after the module is already in the cache 54// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \ 55// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \ 56// RUN: -x objective-c -verify %s 57 58// Should rebuild the cached module if it had an error (if it wasn't rebuilt 59// the verify would fail as it would be the PCH error instead) 60// RUN: %clang_cc1 -fsyntax-only -fmodules \ 61// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \ 62// RUN: -x objective-c -verify=notallowerror %s 63 64// allow-pcm-with-compiler-errors should also allow errors in PCH 65// RUN: %clang_cc1 -fallow-pcm-with-compiler-errors -x objective-c \ 66// RUN: -o %t/check.pch -emit-pch %S/Inputs/error/error.h 67 68// CHECK: @interface Error 69// CHECK-NEXT: - (int)method; 70// CHECK-NEXT: - (id)method2; 71// CHECK-NEXT: @end 72// CHECK: void test(Error *x) 73 74// RUN: c-index-test -code-completion-at=%s:9:6 %s -fmodules -fmodules-cache-path=%t \ 75// RUN: -Xclang -fallow-pcm-with-compiler-errors -I %S/Inputs/error | FileCheck -check-prefix=COMPLETE %s 76// COMPLETE: ObjCInstanceMethodDecl:{ResultType int}{TypedText method} 77// COMPLETE: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2} 78 79// RUN: c-index-test -test-load-source local %s -fmodules -fmodules-cache-path=%t \ 80// RUN: -Xclang -fallow-pcm-with-compiler-errors -I %S/Inputs/error | FileCheck -check-prefix=SOURCE %s 81// SOURCE: load-module-with-errors.m:8:6: FunctionDecl=test:8:6 (Definition) Extent=[8:1 - 10:2] 82// SOURCE: load-module-with-errors.m:8:18: ParmDecl=x:8:18 (Definition) Extent=[8:11 - 8:19] 83// SOURCE: load-module-with-errors.m:8:11: ObjCClassRef=Error:3:12 Extent=[8:11 - 8:16] 84// SOURCE: load-module-with-errors.m:8:21: CompoundStmt= Extent=[8:21 - 10:2] 85// SOURCE: load-module-with-errors.m:9:3: ObjCMessageExpr=method:4:8 Extent=[9:3 - 9:13] 86