Skip to content

Commit 89ed1bc

Browse files
authored
Merge pull request #4150 from zoecarver/stable/20211026
2 parents 0438c38 + a0de6b6 commit 89ed1bc

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

clang/lib/Sema/SemaAPINotes.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,11 @@ void Sema::ProcessAPINotes(Decl *D) {
873873

874874
return;
875875
}
876-
877-
return;
878876
}
879877

880878
// Enumerators.
881-
if (D->getDeclContext()->getRedeclContext()->isFileContext()) {
879+
if (D->getDeclContext()->getRedeclContext()->isFileContext() ||
880+
D->getDeclContext()->getRedeclContext()->isExternCContext()) {
882881
if (auto EnumConstant = dyn_cast<EnumConstantDecl>(D)) {
883882
for (auto Reader : APINotes.findAPINotes(D->getLocation())) {
884883
auto Info = Reader->lookupEnumConstant(EnumConstant->getName());

clang/test/APINotes/Inputs/Frameworks/CXXInteropKit.framework/Headers/CXXInteropKit.apinotes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
Name: CxxInterop
33
Classes:
44
- Name: NSSomeClass
5-
SwiftName: SomeClass
5+
SwiftName: SomeClass
6+
Enumerators:
7+
- Name: SomeClassRed
8+
SwiftName: red
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
@interface NSSomeClass
22
-(instancetype)init;
3-
@end
3+
@end
4+
5+
// Named "SomeClassRed" for ast node filtering in the test.
6+
enum ColorEnum { SomeClassRed, SomeClassGreen, SomeClassBlue };

clang/test/APINotes/objcxx-swift-name.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66

77
// CHECK: Dumping NSSomeClass:
88
// CHECK-NEXT: ObjCInterfaceDecl {{.+}} imported in CxxInteropKit <undeserialized declarations> NSSomeClass
9-
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SomeClass"
9+
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SomeClass"
10+
11+
// CHECK: Dumping SomeClassRed:
12+
// CHECK-NEXT: EnumConstantDecl {{.+}} imported in CxxInteropKit SomeClassRed 'ColorEnum'
13+
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "red"

0 commit comments

Comments
 (0)