Skip to content

Commit 827cbc5

Browse files
authored
Merge pull request swiftlang#31263 from akyrtzi/5.3-linker-error-astcontext-parser-only-lib
[5.3][AST] Fix a linker error for the parser-only library build
2 parents 469fac1 + 82a86ce commit 827cbc5

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)