Skip to content

[AST] Fix linker errors when doing a 'parser only' build #34976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/AST/ClangTypeConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const clang::Type *ClangTypeConverter::getFunctionType(
ArrayRef<AnyFunctionType::Param> params, Type resultTy,
AnyFunctionType::Representation repr) {

#if SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
return nullptr;
#endif

auto resultClangTy = convert(resultTy);
if (resultClangTy.isNull())
return nullptr;
Expand Down Expand Up @@ -163,6 +167,10 @@ const clang::Type *ClangTypeConverter::getFunctionType(
ArrayRef<SILParameterInfo> params, Optional<SILResultInfo> result,
SILFunctionType::Representation repr) {

#if SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
return nullptr;
#endif

// Using the interface type is sufficient as type parameters get mapped to
// `id`, since ObjC lightweight generics use type erasure. (See also: SE-0057)
auto resultClangTy = result.hasValue()
Expand Down
5 changes: 5 additions & 0 deletions lib/AST/NameLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,11 @@ AnyObjectLookupRequest::evaluate(Evaluator &evaluator, const DeclContext *dc,
using namespace namelookup;
QualifiedLookupResult decls;

#if SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
// Avoid calling `clang::ObjCMethodDecl::isDirectMethod()`.
return decls;
#endif

// Type-only lookup won't find anything on AnyObject.
if (options & NL_OnlyTypes)
return decls;
Expand Down