mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[NFC] Add SerializationOptions to ASTContext
This commit is contained in:
@@ -27,11 +27,12 @@
|
|||||||
#include "swift/AST/Type.h"
|
#include "swift/AST/Type.h"
|
||||||
#include "swift/AST/TypeAlignments.h"
|
#include "swift/AST/TypeAlignments.h"
|
||||||
#include "swift/AST/Types.h"
|
#include "swift/AST/Types.h"
|
||||||
|
#include "swift/Basic/BlockList.h"
|
||||||
#include "swift/Basic/CASOptions.h"
|
#include "swift/Basic/CASOptions.h"
|
||||||
#include "swift/Basic/LangOptions.h"
|
#include "swift/Basic/LangOptions.h"
|
||||||
#include "swift/Basic/Located.h"
|
#include "swift/Basic/Located.h"
|
||||||
#include "swift/Basic/Malloc.h"
|
#include "swift/Basic/Malloc.h"
|
||||||
#include "swift/Basic/BlockList.h"
|
#include "swift/Serialization/SerializationOptions.h"
|
||||||
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
|
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
|
||||||
#include "clang/AST/DeclTemplate.h"
|
#include "clang/AST/DeclTemplate.h"
|
||||||
#include "clang/Basic/DarwinSDKInfo.h"
|
#include "clang/Basic/DarwinSDKInfo.h"
|
||||||
@@ -266,7 +267,8 @@ class ASTContext final {
|
|||||||
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
||||||
ClangImporterOptions &ClangImporterOpts,
|
ClangImporterOptions &ClangImporterOpts,
|
||||||
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
||||||
SourceManager &SourceMgr, DiagnosticEngine &Diags,
|
SerializationOptions &serializationOpts, SourceManager &SourceMgr,
|
||||||
|
DiagnosticEngine &Diags,
|
||||||
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
|
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -283,7 +285,8 @@ public:
|
|||||||
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
||||||
ClangImporterOptions &ClangImporterOpts,
|
ClangImporterOptions &ClangImporterOpts,
|
||||||
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
||||||
SourceManager &SourceMgr, DiagnosticEngine &Diags,
|
SerializationOptions &serializationOpts, SourceManager &SourceMgr,
|
||||||
|
DiagnosticEngine &Diags,
|
||||||
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
|
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
|
||||||
~ASTContext();
|
~ASTContext();
|
||||||
|
|
||||||
@@ -314,6 +317,9 @@ public:
|
|||||||
/// The CAS options used by this AST context.
|
/// The CAS options used by this AST context.
|
||||||
const CASOptions &CASOpts;
|
const CASOptions &CASOpts;
|
||||||
|
|
||||||
|
/// Options for Serialization
|
||||||
|
const SerializationOptions &SerializationOpts;
|
||||||
|
|
||||||
/// The source manager object.
|
/// The source manager object.
|
||||||
SourceManager &SourceMgr;
|
SourceManager &SourceMgr;
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ class CompilerInvocation {
|
|||||||
TBDGenOptions TBDGenOpts;
|
TBDGenOptions TBDGenOpts;
|
||||||
ModuleInterfaceOptions ModuleInterfaceOpts;
|
ModuleInterfaceOptions ModuleInterfaceOpts;
|
||||||
CASOptions CASOpts;
|
CASOptions CASOpts;
|
||||||
|
SerializationOptions SerializationOpts;
|
||||||
llvm::MemoryBuffer *IDEInspectionTargetBuffer = nullptr;
|
llvm::MemoryBuffer *IDEInspectionTargetBuffer = nullptr;
|
||||||
|
|
||||||
/// The offset that IDEInspection wants to further examine in offset of bytes
|
/// The offset that IDEInspection wants to further examine in offset of bytes
|
||||||
@@ -327,6 +328,11 @@ public:
|
|||||||
IRGenOptions &getIRGenOptions() { return IRGenOpts; }
|
IRGenOptions &getIRGenOptions() { return IRGenOpts; }
|
||||||
const IRGenOptions &getIRGenOptions() const { return IRGenOpts; }
|
const IRGenOptions &getIRGenOptions() const { return IRGenOpts; }
|
||||||
|
|
||||||
|
SerializationOptions &getSerializationOptions() { return SerializationOpts; }
|
||||||
|
const SerializationOptions &getSerializationOptions() const {
|
||||||
|
return SerializationOpts;
|
||||||
|
}
|
||||||
|
|
||||||
void setParseStdlib() {
|
void setParseStdlib() {
|
||||||
FrontendOpts.ParseStdlib = true;
|
FrontendOpts.ParseStdlib = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,12 @@
|
|||||||
namespace swift {
|
namespace swift {
|
||||||
|
|
||||||
class SerializationOptions {
|
class SerializationOptions {
|
||||||
SerializationOptions(const SerializationOptions &) = delete;
|
|
||||||
void operator=(const SerializationOptions &) = delete;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerializationOptions() = default;
|
SerializationOptions() = default;
|
||||||
SerializationOptions(SerializationOptions &&) = default;
|
SerializationOptions(SerializationOptions &&) = default;
|
||||||
SerializationOptions &operator=(SerializationOptions &&) = default;
|
SerializationOptions &operator=(SerializationOptions &&) = default;
|
||||||
|
SerializationOptions(const SerializationOptions &) = default;
|
||||||
|
SerializationOptions &operator=(const SerializationOptions &) = default;
|
||||||
~SerializationOptions() = default;
|
~SerializationOptions() = default;
|
||||||
|
|
||||||
StringRef OutputPath;
|
StringRef OutputPath;
|
||||||
|
|||||||
@@ -757,7 +757,8 @@ ASTContext *ASTContext::get(
|
|||||||
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
||||||
ClangImporterOptions &ClangImporterOpts,
|
ClangImporterOptions &ClangImporterOpts,
|
||||||
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
||||||
SourceManager &SourceMgr, DiagnosticEngine &Diags,
|
SerializationOptions &serializationOpts, SourceManager &SourceMgr,
|
||||||
|
DiagnosticEngine &Diags,
|
||||||
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutputBackend) {
|
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutputBackend) {
|
||||||
// If more than two data structures are concatentated, then the aggregate
|
// If more than two data structures are concatentated, then the aggregate
|
||||||
// size math needs to become more complicated due to per-struct alignment
|
// size math needs to become more complicated due to per-struct alignment
|
||||||
@@ -771,8 +772,8 @@ ASTContext *ASTContext::get(
|
|||||||
new (impl) Implementation();
|
new (impl) Implementation();
|
||||||
return new (mem)
|
return new (mem)
|
||||||
ASTContext(langOpts, typecheckOpts, silOpts, SearchPathOpts,
|
ASTContext(langOpts, typecheckOpts, silOpts, SearchPathOpts,
|
||||||
ClangImporterOpts, SymbolGraphOpts, casOpts, SourceMgr, Diags,
|
ClangImporterOpts, SymbolGraphOpts, casOpts, serializationOpts,
|
||||||
std::move(OutputBackend));
|
SourceMgr, Diags, std::move(OutputBackend));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTContext::ASTContext(
|
ASTContext::ASTContext(
|
||||||
@@ -780,13 +781,15 @@ ASTContext::ASTContext(
|
|||||||
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
|
||||||
ClangImporterOptions &ClangImporterOpts,
|
ClangImporterOptions &ClangImporterOpts,
|
||||||
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
|
||||||
SourceManager &SourceMgr, DiagnosticEngine &Diags,
|
SerializationOptions &SerializationOpts, SourceManager &SourceMgr,
|
||||||
|
DiagnosticEngine &Diags,
|
||||||
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend)
|
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend)
|
||||||
: LangOpts(langOpts), TypeCheckerOpts(typecheckOpts), SILOpts(silOpts),
|
: LangOpts(langOpts), TypeCheckerOpts(typecheckOpts), SILOpts(silOpts),
|
||||||
SearchPathOpts(SearchPathOpts), ClangImporterOpts(ClangImporterOpts),
|
SearchPathOpts(SearchPathOpts), ClangImporterOpts(ClangImporterOpts),
|
||||||
SymbolGraphOpts(SymbolGraphOpts), CASOpts(casOpts), SourceMgr(SourceMgr),
|
SymbolGraphOpts(SymbolGraphOpts), CASOpts(casOpts),
|
||||||
Diags(Diags), OutputBackend(std::move(OutBackend)),
|
SerializationOpts(SerializationOpts), SourceMgr(SourceMgr), Diags(Diags),
|
||||||
evaluator(Diags, langOpts), TheBuiltinModule(createBuiltinModule(*this)),
|
OutputBackend(std::move(OutBackend)), evaluator(Diags, langOpts),
|
||||||
|
TheBuiltinModule(createBuiltinModule(*this)),
|
||||||
StdlibModuleName(getIdentifier(STDLIB_NAME)),
|
StdlibModuleName(getIdentifier(STDLIB_NAME)),
|
||||||
SwiftShimsModuleName(getIdentifier(SWIFT_SHIMS_NAME)),
|
SwiftShimsModuleName(getIdentifier(SWIFT_SHIMS_NAME)),
|
||||||
blockListConfig(SourceMgr),
|
blockListConfig(SourceMgr),
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
|
|||||||
workerCompilerInvocation->getClangImporterOptions(),
|
workerCompilerInvocation->getClangImporterOptions(),
|
||||||
workerCompilerInvocation->getSymbolGraphOptions(),
|
workerCompilerInvocation->getSymbolGraphOptions(),
|
||||||
workerCompilerInvocation->getCASOptions(),
|
workerCompilerInvocation->getCASOptions(),
|
||||||
|
workerCompilerInvocation->getSerializationOptions(),
|
||||||
ScanASTContext.SourceMgr, Diagnostics));
|
ScanASTContext.SourceMgr, Diagnostics));
|
||||||
auto loader = std::make_unique<PluginLoader>(
|
auto loader = std::make_unique<PluginLoader>(
|
||||||
*workerASTContext, /*DepTracker=*/nullptr,
|
*workerASTContext, /*DepTracker=*/nullptr,
|
||||||
|
|||||||
@@ -188,11 +188,12 @@ int modulewrap_main(ArrayRef<const char *> Args, const char *Argv0,
|
|||||||
ClangImporterOptions ClangImporterOpts;
|
ClangImporterOptions ClangImporterOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
||||||
CASOptions CASOpts;
|
CASOptions CASOpts;
|
||||||
|
SerializationOptions SerializationOpts;
|
||||||
LangOpts.Target = Invocation.getTargetTriple();
|
LangOpts.Target = Invocation.getTargetTriple();
|
||||||
LangOpts.EnableObjCInterop = Invocation.enableObjCInterop();
|
LangOpts.EnableObjCInterop = Invocation.enableObjCInterop();
|
||||||
ASTContext &ASTCtx = *ASTContext::get(
|
ASTContext &ASTCtx = *ASTContext::get(
|
||||||
LangOpts, TypeCheckOpts, SILOpts, SearchPathOpts, ClangImporterOpts,
|
LangOpts, TypeCheckOpts, SILOpts, SearchPathOpts, ClangImporterOpts,
|
||||||
SymbolGraphOpts, CASOpts, SrcMgr, Instance.getDiags(),
|
SymbolGraphOpts, CASOpts, SerializationOpts, SrcMgr, Instance.getDiags(),
|
||||||
llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>());
|
llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>());
|
||||||
registerParseRequestFunctions(ASTCtx.evaluator);
|
registerParseRequestFunctions(ASTCtx.evaluator);
|
||||||
registerTypeCheckerRequestFunctions(ASTCtx.evaluator);
|
registerTypeCheckerRequestFunctions(ASTCtx.evaluator);
|
||||||
|
|||||||
@@ -82,9 +82,10 @@ struct LibParseExecutor {
|
|||||||
ClangImporterOptions clangOpts;
|
ClangImporterOptions clangOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
||||||
CASOptions casOpts;
|
CASOptions casOpts;
|
||||||
std::unique_ptr<ASTContext> ctx(
|
SerializationOptions serializationOpts;
|
||||||
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,
|
std::unique_ptr<ASTContext> ctx(ASTContext::get(
|
||||||
clangOpts, symbolOpts, casOpts, SM, diagEngine));
|
langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts, symbolOpts,
|
||||||
|
casOpts, serializationOpts, SM, diagEngine));
|
||||||
|
|
||||||
SourceFile::ParsingOptions parseOpts;
|
SourceFile::ParsingOptions parseOpts;
|
||||||
parseOpts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation;
|
parseOpts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation;
|
||||||
@@ -153,13 +154,14 @@ struct ASTGenExecutor {
|
|||||||
ClangImporterOptions clangOpts;
|
ClangImporterOptions clangOpts;
|
||||||
CASOptions casOpts;
|
CASOptions casOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
||||||
|
SerializationOptions serializationOpts;
|
||||||
|
|
||||||
// Enable ASTGen.
|
// Enable ASTGen.
|
||||||
langOpts.enableFeature(Feature::ParserASTGen);
|
langOpts.enableFeature(Feature::ParserASTGen);
|
||||||
|
|
||||||
std::unique_ptr<ASTContext> ctx(
|
std::unique_ptr<ASTContext> ctx(ASTContext::get(
|
||||||
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,
|
langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts, symbolOpts,
|
||||||
clangOpts, symbolOpts, casOpts, SM, diagEngine));
|
casOpts, serializationOpts, SM, diagEngine));
|
||||||
registerParseRequestFunctions(ctx->evaluator);
|
registerParseRequestFunctions(ctx->evaluator);
|
||||||
registerTypeCheckerRequestFunctions(ctx->evaluator);
|
registerTypeCheckerRequestFunctions(ctx->evaluator);
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,8 @@ bool CompilerInstance::setUpASTContextIfNeeded() {
|
|||||||
Invocation.getLangOptions(), Invocation.getTypeCheckerOptions(),
|
Invocation.getLangOptions(), Invocation.getTypeCheckerOptions(),
|
||||||
Invocation.getSILOptions(), Invocation.getSearchPathOptions(),
|
Invocation.getSILOptions(), Invocation.getSearchPathOptions(),
|
||||||
Invocation.getClangImporterOptions(), Invocation.getSymbolGraphOptions(),
|
Invocation.getClangImporterOptions(), Invocation.getSymbolGraphOptions(),
|
||||||
Invocation.getCASOptions(), SourceMgr, Diagnostics, OutputBackend));
|
Invocation.getCASOptions(), Invocation.getSerializationOptions(),
|
||||||
|
SourceMgr, Diagnostics, OutputBackend));
|
||||||
if (!Invocation.getFrontendOptions().ModuleAliasMap.empty())
|
if (!Invocation.getFrontendOptions().ModuleAliasMap.empty())
|
||||||
Context->setModuleAliases(Invocation.getFrontendOptions().ModuleAliasMap);
|
Context->setModuleAliases(Invocation.getFrontendOptions().ModuleAliasMap);
|
||||||
|
|
||||||
|
|||||||
@@ -128,11 +128,12 @@ getModifiedFunctionDeclList(const SourceFile &SF, SourceManager &tmpSM,
|
|||||||
SILOptions silOpts = ctx.SILOpts;
|
SILOptions silOpts = ctx.SILOpts;
|
||||||
CASOptions casOpts = ctx.CASOpts;
|
CASOptions casOpts = ctx.CASOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions symbolOpts = ctx.SymbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions symbolOpts = ctx.SymbolGraphOpts;
|
||||||
|
SerializationOptions serializationOpts = ctx.SerializationOpts;
|
||||||
|
|
||||||
DiagnosticEngine tmpDiags(tmpSM);
|
DiagnosticEngine tmpDiags(tmpSM);
|
||||||
auto &tmpCtx =
|
auto &tmpCtx =
|
||||||
*ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts,
|
*ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts,
|
||||||
symbolOpts, casOpts, tmpSM, tmpDiags);
|
symbolOpts, casOpts, serializationOpts, tmpSM, tmpDiags);
|
||||||
registerParseRequestFunctions(tmpCtx.evaluator);
|
registerParseRequestFunctions(tmpCtx.evaluator);
|
||||||
registerTypeCheckerRequestFunctions(tmpCtx.evaluator);
|
registerTypeCheckerRequestFunctions(tmpCtx.evaluator);
|
||||||
|
|
||||||
|
|||||||
@@ -241,9 +241,11 @@ bool IDEInspectionInstance::performCachedOperationIfPossible(
|
|||||||
ClangImporterOptions clangOpts;
|
ClangImporterOptions clangOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
symbolgraphgen::SymbolGraphOptions symbolOpts;
|
||||||
CASOptions casOpts;
|
CASOptions casOpts;
|
||||||
|
SerializationOptions serializationOpts =
|
||||||
|
CachedCI->getASTContext().SerializationOpts;
|
||||||
std::unique_ptr<ASTContext> tmpCtx(
|
std::unique_ptr<ASTContext> tmpCtx(
|
||||||
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts,
|
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, clangOpts,
|
||||||
symbolOpts, casOpts, tmpSM, tmpDiags));
|
symbolOpts, casOpts, serializationOpts, tmpSM, tmpDiags));
|
||||||
tmpCtx->CancellationFlag = CancellationFlag;
|
tmpCtx->CancellationFlag = CancellationFlag;
|
||||||
registerParseRequestFunctions(tmpCtx->evaluator);
|
registerParseRequestFunctions(tmpCtx->evaluator);
|
||||||
registerIDERequestFunctions(tmpCtx->evaluator);
|
registerIDERequestFunctions(tmpCtx->evaluator);
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ bool SyntacticMacroExpansionInstance::setup(
|
|||||||
invocation.getLangOptions(), invocation.getTypeCheckerOptions(),
|
invocation.getLangOptions(), invocation.getTypeCheckerOptions(),
|
||||||
invocation.getSILOptions(), invocation.getSearchPathOptions(),
|
invocation.getSILOptions(), invocation.getSearchPathOptions(),
|
||||||
invocation.getClangImporterOptions(), invocation.getSymbolGraphOptions(),
|
invocation.getClangImporterOptions(), invocation.getSymbolGraphOptions(),
|
||||||
invocation.getCASOptions(), SourceMgr, Diags));
|
invocation.getCASOptions(), invocation.getSerializationOptions(),
|
||||||
|
SourceMgr, Diags));
|
||||||
registerParseRequestFunctions(Ctx->evaluator);
|
registerParseRequestFunctions(Ctx->evaluator);
|
||||||
registerTypeCheckerRequestFunctions(Ctx->evaluator);
|
registerTypeCheckerRequestFunctions(Ctx->evaluator);
|
||||||
|
|
||||||
|
|||||||
@@ -1126,6 +1126,7 @@ struct ParserUnit::Implementation {
|
|||||||
ClangImporterOptions clangImporterOpts;
|
ClangImporterOptions clangImporterOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
||||||
CASOptions CASOpts;
|
CASOptions CASOpts;
|
||||||
|
SerializationOptions SerializationOpts;
|
||||||
DiagnosticEngine Diags;
|
DiagnosticEngine Diags;
|
||||||
ASTContext &Ctx;
|
ASTContext &Ctx;
|
||||||
SourceFile *SF;
|
SourceFile *SF;
|
||||||
@@ -1136,8 +1137,8 @@ struct ParserUnit::Implementation {
|
|||||||
const SILOptions &silOpts, StringRef ModuleName)
|
const SILOptions &silOpts, StringRef ModuleName)
|
||||||
: LangOpts(Opts), TypeCheckerOpts(TyOpts), SILOpts(silOpts), Diags(SM),
|
: LangOpts(Opts), TypeCheckerOpts(TyOpts), SILOpts(silOpts), Diags(SM),
|
||||||
Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts, SearchPathOpts,
|
Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts, SearchPathOpts,
|
||||||
clangImporterOpts, symbolGraphOpts, CASOpts, SM,
|
clangImporterOpts, symbolGraphOpts, CASOpts,
|
||||||
Diags)) {
|
SerializationOpts, SM, Diags)) {
|
||||||
registerParseRequestFunctions(Ctx.evaluator);
|
registerParseRequestFunctions(Ctx.evaluator);
|
||||||
|
|
||||||
auto parsingOpts = SourceFile::getDefaultParsingOptions(LangOpts);
|
auto parsingOpts = SourceFile::getDefaultParsingOptions(LangOpts);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static Decl *createOptionalType(ASTContext &ctx, SourceFile *fileForLookups,
|
|||||||
TestContext::TestContext(ShouldDeclareOptionalTypes optionals)
|
TestContext::TestContext(ShouldDeclareOptionalTypes optionals)
|
||||||
: Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts, SearchPathOpts,
|
: Ctx(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts, SearchPathOpts,
|
||||||
ClangImporterOpts, SymbolGraphOpts, CASOpts,
|
ClangImporterOpts, SymbolGraphOpts, CASOpts,
|
||||||
SourceMgr, Diags)) {
|
SerializationOpts, SourceMgr, Diags)) {
|
||||||
registerParseRequestFunctions(Ctx.evaluator);
|
registerParseRequestFunctions(Ctx.evaluator);
|
||||||
registerTypeCheckerRequestFunctions(Ctx.evaluator);
|
registerTypeCheckerRequestFunctions(Ctx.evaluator);
|
||||||
registerClangImporterRequestFunctions(Ctx.evaluator);
|
registerClangImporterRequestFunctions(Ctx.evaluator);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
ClangImporterOptions ClangImporterOpts;
|
ClangImporterOptions ClangImporterOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
||||||
CASOptions CASOpts;
|
CASOptions CASOpts;
|
||||||
|
SerializationOptions SerializationOpts;
|
||||||
SourceManager SourceMgr;
|
SourceManager SourceMgr;
|
||||||
DiagnosticEngine Diags;
|
DiagnosticEngine Diags;
|
||||||
|
|
||||||
|
|||||||
@@ -80,11 +80,12 @@ TEST(ClangImporterTest, emitPCHInMemory) {
|
|||||||
swift::SearchPathOptions searchPathOpts;
|
swift::SearchPathOptions searchPathOpts;
|
||||||
swift::symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
swift::symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
||||||
swift::CASOptions casOpts;
|
swift::CASOptions casOpts;
|
||||||
|
swift::SerializationOptions serializationOpts;
|
||||||
swift::SourceManager sourceMgr;
|
swift::SourceManager sourceMgr;
|
||||||
swift::DiagnosticEngine diags(sourceMgr);
|
swift::DiagnosticEngine diags(sourceMgr);
|
||||||
std::unique_ptr<ASTContext> context(
|
std::unique_ptr<ASTContext> context(ASTContext::get(
|
||||||
ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts, options,
|
langOpts, typecheckOpts, silOpts, searchPathOpts, options,
|
||||||
symbolGraphOpts, casOpts, sourceMgr, diags));
|
symbolGraphOpts, casOpts, serializationOpts, sourceMgr, diags));
|
||||||
auto importer = ClangImporter::create(*context);
|
auto importer = ClangImporter::create(*context);
|
||||||
|
|
||||||
std::string PCH = createFilename(cache, "bridging.h.pch");
|
std::string PCH = createFilename(cache, "bridging.h.pch");
|
||||||
@@ -197,14 +198,15 @@ TEST(ClangImporterTest, libStdCxxInjectionTest) {
|
|||||||
swift::DiagnosticEngine diags(sourceMgr);
|
swift::DiagnosticEngine diags(sourceMgr);
|
||||||
ClangImporterOptions options;
|
ClangImporterOptions options;
|
||||||
CASOptions casOpts;
|
CASOptions casOpts;
|
||||||
|
SerializationOptions serializationOpts;
|
||||||
options.clangPath = "/usr/bin/clang";
|
options.clangPath = "/usr/bin/clang";
|
||||||
options.ExtraArgs.push_back(
|
options.ExtraArgs.push_back(
|
||||||
(llvm::Twine("--gcc-toolchain=") + "/opt/rh/devtoolset-9/root/usr")
|
(llvm::Twine("--gcc-toolchain=") + "/opt/rh/devtoolset-9/root/usr")
|
||||||
.str());
|
.str());
|
||||||
options.ExtraArgs.push_back("--gcc-toolchain");
|
options.ExtraArgs.push_back("--gcc-toolchain");
|
||||||
std::unique_ptr<ASTContext> context(
|
std::unique_ptr<ASTContext> context(ASTContext::get(
|
||||||
ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts, options,
|
langOpts, typecheckOpts, silOpts, searchPathOpts, options,
|
||||||
symbolGraphOpts, casOpts, sourceMgr, diags));
|
symbolGraphOpts, casOpts, serializationOpts, sourceMgr, diags));
|
||||||
|
|
||||||
{
|
{
|
||||||
LibStdCxxInjectionVFS vfs;
|
LibStdCxxInjectionVFS vfs;
|
||||||
|
|||||||
@@ -104,9 +104,10 @@ protected:
|
|||||||
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
|
||||||
SILOptions silOpts;
|
SILOptions silOpts;
|
||||||
CASOptions casOpts;
|
CASOptions casOpts;
|
||||||
|
SerializationOptions serializationOpts;
|
||||||
auto ctx = ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts,
|
auto ctx = ASTContext::get(langOpts, typecheckOpts, silOpts, searchPathOpts,
|
||||||
clangImpOpts, symbolGraphOpts, casOpts,
|
clangImpOpts, symbolGraphOpts, casOpts,
|
||||||
sourceMgr, diags);
|
serializationOpts, sourceMgr, diags);
|
||||||
|
|
||||||
ctx->addModuleInterfaceChecker(
|
ctx->addModuleInterfaceChecker(
|
||||||
std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir,
|
std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir,
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ using namespace swift::unittest;
|
|||||||
using namespace swift::constraints::inference;
|
using namespace swift::constraints::inference;
|
||||||
|
|
||||||
SemaTest::SemaTest()
|
SemaTest::SemaTest()
|
||||||
: Context(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts,
|
: Context(*ASTContext::get(
|
||||||
SearchPathOpts, ClangImporterOpts,
|
LangOpts, TypeCheckerOpts, SILOpts, SearchPathOpts, ClangImporterOpts,
|
||||||
SymbolGraphOpts, CASOpts, SourceMgr, Diags)) {
|
SymbolGraphOpts, CASOpts, SerializationOpts, SourceMgr, Diags)) {
|
||||||
INITIALIZE_LLVM();
|
INITIALIZE_LLVM();
|
||||||
|
|
||||||
registerParseRequestFunctions(Context.evaluator);
|
registerParseRequestFunctions(Context.evaluator);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
ClangImporterOptions ClangImporterOpts;
|
ClangImporterOptions ClangImporterOpts;
|
||||||
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
|
||||||
CASOptions CASOpts;
|
CASOptions CASOpts;
|
||||||
|
SerializationOptions SerializationOpts;
|
||||||
SourceManager SourceMgr;
|
SourceManager SourceMgr;
|
||||||
DiagnosticEngine Diags;
|
DiagnosticEngine Diags;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user