1// RUN: rm -rf %t 2 3// Set up directories 4// RUN: mkdir -p %t/APINotes 5// RUN: cp %S/Inputs/APINotes/SomeOtherKit.apinotes %t/APINotes/SomeOtherKit.apinotes 6// RUN: mkdir -p %t/Frameworks 7// RUN: cp -r %S/Inputs/Frameworks/SomeOtherKit.framework %t/Frameworks 8 9// First build: check that 'methodB' is unavailable but 'methodA' is available. 10// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&1 11// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log 12// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/before.log 13// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log 14 15// Do it again; now we're using caches. 16// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&1 17// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log 18// RUN: FileCheck -check-prefix=CHECK-WITHOUT-REBUILD %s < %t/before.log 19// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log 20 21// Add a blank line to the header to force the module to rebuild, without 22// (yet) changing API notes. 23// RUN: echo >> %t/Frameworks/SomeOtherKit.framework/Headers/SomeOtherKit.h 24// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/before.log 2>&1 25// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/before.log 26// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/before.log 27// RUN: FileCheck -check-prefix=CHECK-ONE-ERROR %s < %t/before.log 28 29// Change the API notes file, after the module has rebuilt once. 30// RUN: chmod u+w %t/APINotes/SomeOtherKit.apinotes 31// RUN: echo ' - Selector: "methodA"' >> %t/APINotes/SomeOtherKit.apinotes 32// RUN: echo ' MethodKind: Instance' >> %t/APINotes/SomeOtherKit.apinotes 33// RUN: echo ' Availability: none' >> %t/APINotes/SomeOtherKit.apinotes 34// RUN: echo ' AvailabilityMsg: "not here either"' >> %t/APINotes/SomeOtherKit.apinotes 35 36// Build again: check that both methods are now unavailable and that the module rebuilt. 37// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/after.log 2>&1 38// RUN: FileCheck -check-prefix=CHECK-METHODA %s < %t/after.log 39// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/after.log 40// RUN: FileCheck -check-prefix=CHECK-REBUILD %s < %t/after.log 41// RUN: FileCheck -check-prefix=CHECK-TWO-ERRORS %s < %t/after.log 42 43// Run the build again: check that both methods are now unavailable 44// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -Rmodule-build -fmodules-cache-path=%t/ModulesCache -iapinotes-modules %t/APINotes -F %t/Frameworks %s > %t/after.log 2>&1 45// RUN: FileCheck -check-prefix=CHECK-METHODA %s < %t/after.log 46// RUN: FileCheck -check-prefix=CHECK-METHODB %s < %t/after.log 47// RUN: FileCheck -check-prefix=CHECK-WITHOUT-REBUILD %s < %t/after.log 48// RUN: FileCheck -check-prefix=CHECK-TWO-ERRORS %s < %t/after.log 49 50@import SomeOtherKit; 51 52void test(A *a) { 53 // CHECK-METHODA: error: 'methodA' is unavailable: not here either 54 [a methodA]; 55 56 // CHECK-METHODB: error: 'methodB' is unavailable: anything but this 57 [a methodB]; 58} 59 60// CHECK-REBUILD: remark: building module{{.*}}SomeOtherKit 61 62// CHECK-WITHOUT-REBUILD-NOT: remark: building module{{.*}}SomeOtherKit 63 64// CHECK-ONE-ERROR: 1 error generated. 65// CHECK-TWO-ERRORS: 2 errors generated. 66 67