Skip to content

Commit 7f0209a

Browse files
authored
Merge pull request #31250 from akyrtzi/linker-error-astcontext-parser-only-lib
[AST] Fix a linker error for the parser-only library build
2 parents 083e95c + d1bf555 commit 7f0209a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/AST/ASTContext.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,19 @@ struct ASTContext::Implementation {
475475
/// The IRGen specific SIL transforms that have been registered.
476476
SILTransformCtors IRGenSILPasses;
477477

478+
#if !SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
478479
/// The scratch context used to allocate intrinsic data on behalf of \c swift::IntrinsicInfo
479480
std::unique_ptr<llvm::LLVMContext> IntrinsicScratchContext;
481+
#endif
480482
};
481483

482484
ASTContext::Implementation::Implementation()
483485
: IdentifierTable(Allocator),
484-
TheSyntaxArena(new syntax::SyntaxArena()),
485-
IntrinsicScratchContext(new llvm::LLVMContext()) {}
486+
TheSyntaxArena(new syntax::SyntaxArena())
487+
#if !SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
488+
, IntrinsicScratchContext(new llvm::LLVMContext())
489+
#endif
490+
{}
486491
ASTContext::Implementation::~Implementation() {
487492
for (auto &cleanup : Cleanups)
488493
cleanup();
@@ -4799,6 +4804,8 @@ AutoDiffDerivativeFunctionIdentifier *AutoDiffDerivativeFunctionIdentifier::get(
47994804
}
48004805

48014806
llvm::LLVMContext &ASTContext::getIntrinsicScratchContext() const {
4807+
#if !SWIFT_BUILD_ONLY_SYNTAXPARSERLIB
48024808
return *getImpl().IntrinsicScratchContext.get();
4809+
#endif
48034810
}
48044811

0 commit comments

Comments
 (0)