Skip to content

Commit 7964918

Browse files
committed
[cxx-interop] Fix sema lookup scope so we find NSNotification interface even in C++ mode.
1 parent 4f4d014 commit 7964918

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lib/ClangImporter/ClangAdapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ clang::TypedefNameDecl *importer::findSwiftNewtype(const clang::NamedDecl *decl,
554554
clang::LookupResult lookupResult(clangSema, notificationName,
555555
clang::SourceLocation(),
556556
clang::Sema::LookupOrdinaryName);
557-
if (!clangSema.LookupName(lookupResult, nullptr))
557+
if (!clangSema.LookupName(lookupResult, clangSema.TUScope))
558558
return nullptr;
559559
auto nsDecl = lookupResult.getAsSingle<clang::TypedefNameDecl>();
560560
if (!nsDecl)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#import <Foundation/Foundation.h>
2+
3+
extern NSString * const SpaceShipNotification;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=NSNofiticationBridging -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop | %FileCheck %s
2+
3+
// REQUIRES: objc_interop
4+
5+
// CHECK: @_exported import Foundation
6+
7+
// CHECK: @available(swift, obsoleted: 3, renamed: "NSNotification.Name.SpaceShip")
8+
// CHECK: let SpaceShipNotification: NSNotification.Name

0 commit comments

Comments
 (0)