Skip to content

Commit a752315

Browse files
committed
Fixup unavailable check and validate stderr differently
1 parent 4a44bf9 commit a752315

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

clang/include/clang/AST/Availability.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ struct AvailabilityInfo {
7979
/// Check if the symbol has been obsoleted.
8080
bool isObsoleted() const { return !Obsoleted.empty(); }
8181

82-
/// Check if the symbol is unavailable for the active platform and os version.
83-
bool isUnavailable() const { return Unavailable; }
82+
/// Check if the symbol is unavailable unconditionally or
83+
/// on the active platform and os version.
84+
bool isUnavailable() const {
85+
return Unavailable || isUnconditionallyUnavailable();
86+
}
8487

8588
/// Check if the symbol is unconditionally deprecated.
8689
///

clang/test/InstallAPI/availability.test

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,30 @@
99
; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \
1010
; RUN: -current_version 1 -compatibility_version 1 \
1111
; RUN: -F %t/System/Library/Frameworks \
12-
; RUN: %t/inputs.json -o output.tbd \
12+
; RUN: %t/inputs.json -o %t/output.tbd \
1313
; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \
14-
; RUN: --verify-mode=ErrorsOnly --filetype=tbd-v5 2>&1 | FileCheck -allow-empty -check-prefix=ERRORSONLY %s
14+
; RUN: --verify-mode=ErrorsOnly --filetype=tbd-v5 2> %t/errors.log
15+
; RUN: FileCheck -allow-empty -check-prefix=ERRORSONLY -input-file %t/errors.log %s
1516

1617
; RUN: clang-installapi \
1718
; RUN: --target=x86_64-apple-macos13 \
1819
; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \
1920
; RUN: -current_version 1 -compatibility_version 1 \
2021
; RUN: -F %t/System/Library/Frameworks \
21-
; RUN: %t/inputs.json -o output-warnings.tbd \
22+
; RUN: %t/inputs.json -o %t/output-warnings.tbd \
2223
; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \
23-
; RUN: --verify-mode=ErrorsAndWarnings 2>&1 | FileCheck -check-prefixes=VIOLATIONS,ERRORSANDWARNINGS %s
24+
; RUN: --verify-mode=ErrorsAndWarnings 2> %t/errors.log
25+
; RUN: FileCheck -check-prefixes=VIOLATIONS,ERRORSANDWARNINGS -input-file %t/errors.log %s
2426

2527
; RUN: not clang-installapi \
2628
; RUN: --target=x86_64-apple-macos13 \
2729
; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \
2830
; RUN: -current_version 1 -compatibility_version 1 \
2931
; RUN: -F %t/System/Library/Frameworks \
30-
; RUN: %t/inputs.json -o output-pedantic.tbd \
32+
; RUN: %t/inputs.json -o %t/output-pedantic.tbd \
3133
; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \
32-
; RUN: --verify-mode=Pedantic 2>&1 | FileCheck -check-prefixes=VIOLATIONS,PEDANTIC %s
34+
; RUN: --verify-mode=Pedantic 2> %t/errors.log
35+
; RUN: FileCheck -check-prefixes=VIOLATIONS,PEDANTIC -input-file %t/errors.log %s
3336

3437
; ERRORSONLY-NOT: error
3538
; ERRORSONLY-NOT: warning
@@ -40,6 +43,8 @@
4043
; VIOLATIONS-NEXT: extern int publicGlobalVariable NS_AVAILABLE
4144
; VIOLATIONS: declaration 'Foo' is marked unavailable, but symbol is exported in dynamic library
4245
; VIOLATIONS-NEXT: @interface Foo : NSObject
46+
; VIOLATIONS: declaration 'publicGlobalVariable3' is marked unavailable, but symbol is exported in dynamic library
47+
; VIOLATIONS-NEXT: extern int publicGlobalVariable3 __attribute__((unavailable))
4348
; VIOLATIONS: declaration 'privateGlobalVariable' is marked unavailable, but symbol is exported in dynamic library
4449
; VIOLATIONS-NEXT: extern int privateGlobalVariable;
4550

clang/test/InstallAPI/diagnostics-cpp.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// RUN: -install_name /System/Library/Frameworks/MismatchCpp.framework/Versions/A/MismatchCpp \
1010
// RUN: -current_version 1 -compatibility_version 1 %t/inputs.json \
1111
// RUN: --verify-against=%t/System/Library/Frameworks/MismatchCpp.framework/MismatchCpp \
12-
// RUN: --verify-mode=Pedantic -o output.tbd --demangle 2>&1 | FileCheck %s
12+
// RUN: --verify-mode=Pedantic -o output.tbd --demangle 2> %t/errors.log
13+
// RUN: FileCheck -input-file %t/errors.log %s
1314

1415
CHECK: warning: violations found for arm64-apple-macos13
1516
CHECK: CPP.h:5:7: error: declaration has external linkage, but symbol has internal linkage in dynamic library 'vtable for Bar'

0 commit comments

Comments
 (0)