[PATCH] D121748: [clang][Sema] Better support for ObjC++ in Sema::LookupName

Alex Langford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 10:12:16 PDT 2022


bulbazord added a comment.

In D121748#3384357 <https://reviews.llvm.org/D121748#3384357>, @arphaman wrote:

> Is there a Swift-based test case you have that demonstrates the original problem from Swift's clang importer side? I'm curious to see where it manifests in Swift.



  % cat Test.h
  @protocol Foo
  @end
  @interface Foo <Foo>
  @end
  
  % cat test.swift
  import Test
  
  public protocol Thing: FooProtocol {
  }
  
  % cat module.modulemap
  module Test [extern_c] {
    header "Test.h"
  }
  
  % $SWIFT_BUILD_DIR/bin/swiftc -frontend -c -enable-cxx-interop -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/ -I. -o /tmp/foo.o test.swift
  test.swift:3:24: error: cannot find type 'FooProtocol' in scope
  public protocol Thing: FooProtocol {
                         ^~~~~~~~~~~

There's a call to `Sema::LookupName` that fails for the reason I outlined in the description when building the `SwiftLookupTable` during PCM creation time. The renaming of `@protocol Foo` to `protocol FooProtocol` doesn't occur because it thinks there is no naming conflict.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121748/new/

https://reviews.llvm.org/D121748



More information about the cfe-commits mailing list