mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Grab the private discriminator for a file in IRGenDebugInfo
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed. Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
This commit is contained in:
@@ -303,6 +303,16 @@ public:
|
|||||||
return OptMode == OptimizationMode::ForSize;
|
return OptMode == OptimizationMode::ForSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getDebugFlags(StringRef PrivateDiscriminator) const {
|
||||||
|
std::string Flags = DebugFlags;
|
||||||
|
if (!PrivateDiscriminator.empty()) {
|
||||||
|
if (!Flags.empty())
|
||||||
|
Flags += " ";
|
||||||
|
Flags += ("-private-discriminator " + PrivateDiscriminator).str();
|
||||||
|
}
|
||||||
|
return Flags;
|
||||||
|
}
|
||||||
|
|
||||||
/// Return a hash code of any components from these options that should
|
/// Return a hash code of any components from these options that should
|
||||||
/// contribute to a Swift Bridging PCH hash.
|
/// contribute to a Swift Bridging PCH hash.
|
||||||
llvm::hash_code getPCHHashComponents() const {
|
llvm::hash_code getPCHHashComponents() const {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class IRGenModule;
|
|||||||
std::pair<IRGenerator *, IRGenModule *>
|
std::pair<IRGenerator *, IRGenModule *>
|
||||||
createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
|
createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
|
||||||
StringRef MainInputFilenameForDebugInfo,
|
StringRef MainInputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator,
|
||||||
llvm::LLVMContext &LLVMContext);
|
llvm::LLVMContext &LLVMContext);
|
||||||
|
|
||||||
/// Delete the IRGenModule and IRGenerator obtained by the above call.
|
/// Delete the IRGenModule and IRGenerator obtained by the above call.
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ namespace swift {
|
|||||||
performIRGeneration(IRGenOptions &Opts, SourceFile &SF,
|
performIRGeneration(IRGenOptions &Opts, SourceFile &SF,
|
||||||
std::unique_ptr<SILModule> SILMod,
|
std::unique_ptr<SILModule> SILMod,
|
||||||
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
|
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
|
||||||
|
StringRef PrivateDiscriminator,
|
||||||
llvm::LLVMContext &LLVMContext,
|
llvm::LLVMContext &LLVMContext,
|
||||||
llvm::GlobalVariable **outModuleHash = nullptr,
|
llvm::GlobalVariable **outModuleHash = nullptr,
|
||||||
llvm::StringSet<> *LinkerDirectives = nullptr);
|
llvm::StringSet<> *LinkerDirectives = nullptr);
|
||||||
|
|||||||
@@ -1371,21 +1371,6 @@ static bool performCompile(CompilerInstance &Instance,
|
|||||||
ReturnValue, observer, Stats);
|
ReturnValue, observer, Stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the main source file's private discriminator and attach it to
|
|
||||||
/// the compile unit's flags.
|
|
||||||
static void setPrivateDiscriminatorIfNeeded(IRGenOptions &IRGenOpts,
|
|
||||||
ModuleOrSourceFile MSF) {
|
|
||||||
if (IRGenOpts.DebugInfoLevel == IRGenDebugInfoLevel::None ||
|
|
||||||
!MSF.is<SourceFile *>())
|
|
||||||
return;
|
|
||||||
Identifier PD = MSF.get<SourceFile *>()->getPrivateDiscriminator();
|
|
||||||
if (!PD.empty()) {
|
|
||||||
if (!IRGenOpts.DebugFlags.empty())
|
|
||||||
IRGenOpts.DebugFlags += " ";
|
|
||||||
IRGenOpts.DebugFlags += ("-private-discriminator " + PD.str()).str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
|
static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
|
||||||
ASTContext &Context, ModuleOrSourceFile MSF) {
|
ASTContext &Context, ModuleOrSourceFile MSF) {
|
||||||
const std::string &moduleOutputPath =
|
const std::string &moduleOutputPath =
|
||||||
@@ -1414,6 +1399,7 @@ static void generateIR(IRGenOptions &IRGenOpts, std::unique_ptr<SILModule> SM,
|
|||||||
IRModule = MSF.is<SourceFile *>()
|
IRModule = MSF.is<SourceFile *>()
|
||||||
? performIRGeneration(IRGenOpts, *MSF.get<SourceFile *>(),
|
? performIRGeneration(IRGenOpts, *MSF.get<SourceFile *>(),
|
||||||
std::move(SM), OutputFilename, PSPs,
|
std::move(SM), OutputFilename, PSPs,
|
||||||
|
MSF.get<SourceFile *>()->getPrivateDiscriminator().str(),
|
||||||
LLVMContext, &HashGlobal,
|
LLVMContext, &HashGlobal,
|
||||||
&LinkerDirectives)
|
&LinkerDirectives)
|
||||||
: performIRGeneration(IRGenOpts, MSF.get<ModuleDecl *>(),
|
: performIRGeneration(IRGenOpts, MSF.get<ModuleDecl *>(),
|
||||||
@@ -1601,8 +1587,6 @@ static bool performCompileStepsPostSILGen(
|
|||||||
emitAnyWholeModulePostTypeCheckSupplementaryOutputs(Instance, Invocation,
|
emitAnyWholeModulePostTypeCheckSupplementaryOutputs(Instance, Invocation,
|
||||||
moduleIsPublic);
|
moduleIsPublic);
|
||||||
|
|
||||||
setPrivateDiscriminatorIfNeeded(IRGenOpts, MSF);
|
|
||||||
|
|
||||||
if (Action == FrontendOptions::ActionType::EmitSIB)
|
if (Action == FrontendOptions::ActionType::EmitSIB)
|
||||||
return serializeSIB(SM.get(), PSPs, Instance.getASTContext(), MSF);
|
return serializeSIB(SM.get(), PSPs, Instance.getASTContext(), MSF);
|
||||||
|
|
||||||
|
|||||||
@@ -808,6 +808,7 @@ static void initLLVMModule(const IRGenModule &IGM, ModuleDecl &M) {
|
|||||||
std::pair<IRGenerator *, IRGenModule *>
|
std::pair<IRGenerator *, IRGenModule *>
|
||||||
swift::irgen::createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
|
swift::irgen::createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
|
||||||
StringRef MainInputFilenameForDebugInfo,
|
StringRef MainInputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator,
|
||||||
llvm::LLVMContext &LLVMContext) {
|
llvm::LLVMContext &LLVMContext) {
|
||||||
|
|
||||||
IRGenOptions Opts;
|
IRGenOptions Opts;
|
||||||
@@ -819,7 +820,8 @@ swift::irgen::createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
|
|||||||
// Create the IR emitter.
|
// Create the IR emitter.
|
||||||
IRGenModule *IGM =
|
IRGenModule *IGM =
|
||||||
new IRGenModule(*irgen, std::move(targetMachine), nullptr, LLVMContext,
|
new IRGenModule(*irgen, std::move(targetMachine), nullptr, LLVMContext,
|
||||||
"", OutputFilename, MainInputFilenameForDebugInfo);
|
"", OutputFilename, MainInputFilenameForDebugInfo,
|
||||||
|
PrivateDiscriminator);
|
||||||
|
|
||||||
initLLVMModule(*IGM, *SILMod->getSwiftModule());
|
initLLVMModule(*IGM, *SILMod->getSwiftModule());
|
||||||
|
|
||||||
@@ -858,6 +860,7 @@ static std::unique_ptr<llvm::Module>
|
|||||||
performIRGeneration(IRGenOptions &Opts, ModuleDecl *M,
|
performIRGeneration(IRGenOptions &Opts, ModuleDecl *M,
|
||||||
std::unique_ptr<SILModule> SILMod, StringRef ModuleName,
|
std::unique_ptr<SILModule> SILMod, StringRef ModuleName,
|
||||||
const PrimarySpecificPaths &PSPs,
|
const PrimarySpecificPaths &PSPs,
|
||||||
|
StringRef PrivateDiscriminator,
|
||||||
llvm::LLVMContext &LLVMContext, SourceFile *SF = nullptr,
|
llvm::LLVMContext &LLVMContext, SourceFile *SF = nullptr,
|
||||||
llvm::GlobalVariable **outModuleHash = nullptr,
|
llvm::GlobalVariable **outModuleHash = nullptr,
|
||||||
llvm::StringSet<> *linkerDirectives = nullptr) {
|
llvm::StringSet<> *linkerDirectives = nullptr) {
|
||||||
@@ -872,7 +875,8 @@ performIRGeneration(IRGenOptions &Opts, ModuleDecl *M,
|
|||||||
// Create the IR emitter.
|
// Create the IR emitter.
|
||||||
IRGenModule IGM(irgen, std::move(targetMachine), nullptr, LLVMContext,
|
IRGenModule IGM(irgen, std::move(targetMachine), nullptr, LLVMContext,
|
||||||
ModuleName, PSPs.OutputFilename,
|
ModuleName, PSPs.OutputFilename,
|
||||||
PSPs.MainInputFilenameForDebugInfo);
|
PSPs.MainInputFilenameForDebugInfo,
|
||||||
|
PrivateDiscriminator);
|
||||||
|
|
||||||
initLLVMModule(IGM, *SILMod->getSwiftModule());
|
initLLVMModule(IGM, *SILMod->getSwiftModule());
|
||||||
|
|
||||||
@@ -1119,7 +1123,8 @@ static void performParallelIRGeneration(
|
|||||||
// Create the IR emitter.
|
// Create the IR emitter.
|
||||||
IRGenModule *IGM =
|
IRGenModule *IGM =
|
||||||
new IRGenModule(irgen, std::move(targetMachine), nextSF, *Context,
|
new IRGenModule(irgen, std::move(targetMachine), nextSF, *Context,
|
||||||
ModuleName, *OutputIter++, nextSF->getFilename());
|
ModuleName, *OutputIter++, nextSF->getFilename(),
|
||||||
|
nextSF->getPrivateDiscriminator().str());
|
||||||
IGMcreated = true;
|
IGMcreated = true;
|
||||||
|
|
||||||
initLLVMModule(*IGM, *SILMod->getSwiftModule());
|
initLLVMModule(*IGM, *SILMod->getSwiftModule());
|
||||||
@@ -1279,19 +1284,21 @@ std::unique_ptr<llvm::Module> swift::performIRGeneration(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return ::performIRGeneration(Opts, M, std::move(SILMod), ModuleName, PSPs,
|
return ::performIRGeneration(Opts, M, std::move(SILMod), ModuleName, PSPs,
|
||||||
LLVMContext, nullptr, outModuleHash,
|
"", LLVMContext, nullptr,
|
||||||
LinkerDirectives);
|
outModuleHash, LinkerDirectives);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<llvm::Module> swift::
|
std::unique_ptr<llvm::Module> swift::
|
||||||
performIRGeneration(IRGenOptions &Opts, SourceFile &SF,
|
performIRGeneration(IRGenOptions &Opts, SourceFile &SF,
|
||||||
std::unique_ptr<SILModule> SILMod,
|
std::unique_ptr<SILModule> SILMod,
|
||||||
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
|
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
|
||||||
|
StringRef PrivateDiscriminator,
|
||||||
llvm::LLVMContext &LLVMContext,
|
llvm::LLVMContext &LLVMContext,
|
||||||
llvm::GlobalVariable **outModuleHash,
|
llvm::GlobalVariable **outModuleHash,
|
||||||
llvm::StringSet<> *LinkerDirectives) {
|
llvm::StringSet<> *LinkerDirectives) {
|
||||||
return ::performIRGeneration(Opts, SF.getParentModule(), std::move(SILMod),
|
return ::performIRGeneration(Opts, SF.getParentModule(), std::move(SILMod),
|
||||||
ModuleName, PSPs, LLVMContext, &SF,
|
ModuleName, PSPs, PrivateDiscriminator,
|
||||||
|
LLVMContext, &SF,
|
||||||
outModuleHash, LinkerDirectives);
|
outModuleHash, LinkerDirectives);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,7 +1318,7 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
|
|||||||
if (!targetMachine) return;
|
if (!targetMachine) return;
|
||||||
|
|
||||||
IRGenModule IGM(irgen, std::move(targetMachine), nullptr, VMContext,
|
IRGenModule IGM(irgen, std::move(targetMachine), nullptr, VMContext,
|
||||||
OutputPath, OutputPath, "");
|
OutputPath, OutputPath, "", "");
|
||||||
initLLVMModule(IGM, *SILMod.getSwiftModule());
|
initLLVMModule(IGM, *SILMod.getSwiftModule());
|
||||||
auto *Ty = llvm::ArrayType::get(IGM.Int8Ty, Buffer.size());
|
auto *Ty = llvm::ArrayType::get(IGM.Int8Ty, Buffer.size());
|
||||||
auto *Data =
|
auto *Data =
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
|
|||||||
public:
|
public:
|
||||||
IRGenDebugInfoImpl(const IRGenOptions &Opts, ClangImporter &CI,
|
IRGenDebugInfoImpl(const IRGenOptions &Opts, ClangImporter &CI,
|
||||||
IRGenModule &IGM, llvm::Module &M,
|
IRGenModule &IGM, llvm::Module &M,
|
||||||
StringRef MainOutputFilenameForDebugInfo);
|
StringRef MainOutputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator);
|
||||||
void finalize();
|
void finalize();
|
||||||
|
|
||||||
void setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
|
void setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
|
||||||
@@ -1664,7 +1665,8 @@ private:
|
|||||||
IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts,
|
IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts,
|
||||||
ClangImporter &CI, IRGenModule &IGM,
|
ClangImporter &CI, IRGenModule &IGM,
|
||||||
llvm::Module &M,
|
llvm::Module &M,
|
||||||
StringRef MainOutputFilenameForDebugInfo)
|
StringRef MainOutputFilenameForDebugInfo,
|
||||||
|
StringRef PD)
|
||||||
: Opts(Opts), CI(CI), SM(IGM.Context.SourceMgr), M(M), DBuilder(M),
|
: Opts(Opts), CI(CI), SM(IGM.Context.SourceMgr), M(M), DBuilder(M),
|
||||||
IGM(IGM), DebugPrefixMap(Opts.DebugPrefixMap) {
|
IGM(IGM), DebugPrefixMap(Opts.DebugPrefixMap) {
|
||||||
assert(Opts.DebugInfoLevel > IRGenDebugInfoLevel::None &&
|
assert(Opts.DebugInfoLevel > IRGenDebugInfoLevel::None &&
|
||||||
@@ -1678,7 +1680,6 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts,
|
|||||||
unsigned Lang = llvm::dwarf::DW_LANG_Swift;
|
unsigned Lang = llvm::dwarf::DW_LANG_Swift;
|
||||||
std::string Producer = version::getSwiftFullVersion(
|
std::string Producer = version::getSwiftFullVersion(
|
||||||
IGM.Context.LangOpts.EffectiveLanguageVersion);
|
IGM.Context.LangOpts.EffectiveLanguageVersion);
|
||||||
StringRef Flags = Opts.DebugFlags;
|
|
||||||
unsigned Major, Minor;
|
unsigned Major, Minor;
|
||||||
std::tie(Major, Minor) = version::getSwiftNumericVersion();
|
std::tie(Major, Minor) = version::getSwiftNumericVersion();
|
||||||
unsigned MajorRuntimeVersion = Major;
|
unsigned MajorRuntimeVersion = Major;
|
||||||
@@ -1693,7 +1694,8 @@ IRGenDebugInfoImpl::IRGenDebugInfoImpl(const IRGenOptions &Opts,
|
|||||||
|
|
||||||
TheCU = DBuilder.createCompileUnit(
|
TheCU = DBuilder.createCompileUnit(
|
||||||
Lang, MainFile,
|
Lang, MainFile,
|
||||||
Producer, Opts.shouldOptimize(), Flags, MajorRuntimeVersion, SplitName,
|
Producer, Opts.shouldOptimize(), Opts.getDebugFlags(PD),
|
||||||
|
MajorRuntimeVersion, SplitName,
|
||||||
Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables
|
Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables
|
||||||
? llvm::DICompileUnit::FullDebug
|
? llvm::DICompileUnit::FullDebug
|
||||||
: llvm::DICompileUnit::LineTablesOnly);
|
: llvm::DICompileUnit::LineTablesOnly);
|
||||||
@@ -2355,9 +2357,11 @@ SILLocation::DebugLoc IRGenDebugInfoImpl::decodeSourceLoc(SourceLoc SL) {
|
|||||||
|
|
||||||
std::unique_ptr<IRGenDebugInfo> IRGenDebugInfo::createIRGenDebugInfo(
|
std::unique_ptr<IRGenDebugInfo> IRGenDebugInfo::createIRGenDebugInfo(
|
||||||
const IRGenOptions &Opts, ClangImporter &CI, IRGenModule &IGM,
|
const IRGenOptions &Opts, ClangImporter &CI, IRGenModule &IGM,
|
||||||
llvm::Module &M, StringRef MainOutputFilenameForDebugInfo) {
|
llvm::Module &M, StringRef MainOutputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator) {
|
||||||
return llvm::make_unique<IRGenDebugInfoImpl>(Opts, CI, IGM, M,
|
return llvm::make_unique<IRGenDebugInfoImpl>(Opts, CI, IGM, M,
|
||||||
MainOutputFilenameForDebugInfo);
|
MainOutputFilenameForDebugInfo,
|
||||||
|
PrivateDiscriminator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ public:
|
|||||||
static std::unique_ptr<IRGenDebugInfo>
|
static std::unique_ptr<IRGenDebugInfo>
|
||||||
createIRGenDebugInfo(const IRGenOptions &Opts, ClangImporter &CI,
|
createIRGenDebugInfo(const IRGenOptions &Opts, ClangImporter &CI,
|
||||||
IRGenModule &IGM, llvm::Module &M,
|
IRGenModule &IGM, llvm::Module &M,
|
||||||
StringRef MainOutputFilenameForDebugInfo);
|
StringRef MainOutputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator);
|
||||||
virtual ~IRGenDebugInfo();
|
virtual ~IRGenDebugInfo();
|
||||||
|
|
||||||
/// Finalize the llvm::DIBuilder owned by this object.
|
/// Finalize the llvm::DIBuilder owned by this object.
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ static llvm::PointerType *createStructPointerType(IRGenModule &IGM,
|
|||||||
static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
|
static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
|
||||||
llvm::LLVMContext &LLVMContext,
|
llvm::LLVMContext &LLVMContext,
|
||||||
IRGenOptions &Opts,
|
IRGenOptions &Opts,
|
||||||
StringRef ModuleName) {
|
StringRef ModuleName,
|
||||||
|
StringRef PD) {
|
||||||
auto Loader = Context.getClangModuleLoader();
|
auto Loader = Context.getClangModuleLoader();
|
||||||
auto *Importer = static_cast<ClangImporter*>(&*Loader);
|
auto *Importer = static_cast<ClangImporter*>(&*Loader);
|
||||||
assert(Importer && "No clang module loader!");
|
assert(Importer && "No clang module loader!");
|
||||||
@@ -119,13 +120,13 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
|
|||||||
case IRGenDebugInfoFormat::DWARF:
|
case IRGenDebugInfoFormat::DWARF:
|
||||||
CGO.DebugCompilationDir = Opts.DebugCompilationDir;
|
CGO.DebugCompilationDir = Opts.DebugCompilationDir;
|
||||||
CGO.DwarfVersion = Opts.DWARFVersion;
|
CGO.DwarfVersion = Opts.DWARFVersion;
|
||||||
CGO.DwarfDebugFlags = Opts.DebugFlags;
|
CGO.DwarfDebugFlags = Opts.getDebugFlags(PD);
|
||||||
break;
|
break;
|
||||||
case IRGenDebugInfoFormat::CodeView:
|
case IRGenDebugInfoFormat::CodeView:
|
||||||
CGO.EmitCodeView = true;
|
CGO.EmitCodeView = true;
|
||||||
CGO.DebugCompilationDir = Opts.DebugCompilationDir;
|
CGO.DebugCompilationDir = Opts.DebugCompilationDir;
|
||||||
// This actually contains the debug flags for codeview.
|
// This actually contains the debug flags for codeview.
|
||||||
CGO.DwarfDebugFlags = Opts.DebugFlags;
|
CGO.DwarfDebugFlags = Opts.getDebugFlags(PD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,10 +145,11 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
|
|||||||
std::unique_ptr<llvm::TargetMachine> &&target,
|
std::unique_ptr<llvm::TargetMachine> &&target,
|
||||||
SourceFile *SF, llvm::LLVMContext &LLVMContext,
|
SourceFile *SF, llvm::LLVMContext &LLVMContext,
|
||||||
StringRef ModuleName, StringRef OutputFilename,
|
StringRef ModuleName, StringRef OutputFilename,
|
||||||
StringRef MainInputFilenameForDebugInfo)
|
StringRef MainInputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator)
|
||||||
: IRGen(irgen), Context(irgen.SIL.getASTContext()),
|
: IRGen(irgen), Context(irgen.SIL.getASTContext()),
|
||||||
ClangCodeGen(createClangCodeGenerator(Context, LLVMContext, irgen.Opts,
|
ClangCodeGen(createClangCodeGenerator(Context, LLVMContext, irgen.Opts,
|
||||||
ModuleName)),
|
ModuleName, PrivateDiscriminator)),
|
||||||
Module(*ClangCodeGen->GetModule()), LLVMContext(Module.getContext()),
|
Module(*ClangCodeGen->GetModule()), LLVMContext(Module.getContext()),
|
||||||
DataLayout(irgen.getClangDataLayout()),
|
DataLayout(irgen.getClangDataLayout()),
|
||||||
Triple(irgen.getEffectiveClangTriple()), TargetMachine(std::move(target)),
|
Triple(irgen.getEffectiveClangTriple()), TargetMachine(std::move(target)),
|
||||||
@@ -491,7 +493,8 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
|
|||||||
if (opts.DebugInfoLevel > IRGenDebugInfoLevel::None)
|
if (opts.DebugInfoLevel > IRGenDebugInfoLevel::None)
|
||||||
DebugInfo = IRGenDebugInfo::createIRGenDebugInfo(IRGen.Opts, *CI, *this,
|
DebugInfo = IRGenDebugInfo::createIRGenDebugInfo(IRGen.Opts, *CI, *this,
|
||||||
Module,
|
Module,
|
||||||
MainInputFilenameForDebugInfo);
|
MainInputFilenameForDebugInfo,
|
||||||
|
PrivateDiscriminator);
|
||||||
|
|
||||||
initClangTypeConverter();
|
initClangTypeConverter();
|
||||||
|
|
||||||
|
|||||||
@@ -1225,14 +1225,15 @@ public:
|
|||||||
IRGenModule(IRGenerator &irgen, std::unique_ptr<llvm::TargetMachine> &&target,
|
IRGenModule(IRGenerator &irgen, std::unique_ptr<llvm::TargetMachine> &&target,
|
||||||
SourceFile *SF, llvm::LLVMContext &LLVMContext,
|
SourceFile *SF, llvm::LLVMContext &LLVMContext,
|
||||||
StringRef ModuleName, StringRef OutputFilename,
|
StringRef ModuleName, StringRef OutputFilename,
|
||||||
StringRef MainInputFilenameForDebugInfo);
|
StringRef MainInputFilenameForDebugInfo,
|
||||||
|
StringRef PrivateDiscriminator);
|
||||||
|
|
||||||
/// The constructor used when we just need an IRGenModule for type lowering.
|
/// The constructor used when we just need an IRGenModule for type lowering.
|
||||||
IRGenModule(IRGenerator &irgen, std::unique_ptr<llvm::TargetMachine> &&target,
|
IRGenModule(IRGenerator &irgen, std::unique_ptr<llvm::TargetMachine> &&target,
|
||||||
llvm::LLVMContext &LLVMContext)
|
llvm::LLVMContext &LLVMContext)
|
||||||
: IRGenModule(irgen, std::move(target), /*SF=*/nullptr, LLVMContext,
|
: IRGenModule(irgen, std::move(target), /*SF=*/nullptr, LLVMContext,
|
||||||
"<fake module name>", "<fake output filename>",
|
"<fake module name>", "<fake output filename>",
|
||||||
"<fake main input filename>") {}
|
"<fake main input filename>", "") {}
|
||||||
|
|
||||||
~IRGenModule();
|
~IRGenModule();
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ int main(int argc, char **argv) {
|
|||||||
auto T = irgen::createIRGenModule(
|
auto T = irgen::createIRGenModule(
|
||||||
SILMod, Invocation.getOutputFilenameForAtMostOnePrimary(),
|
SILMod, Invocation.getOutputFilenameForAtMostOnePrimary(),
|
||||||
Invocation.getMainInputFilenameForDebugInfoForAtMostOnePrimary(),
|
Invocation.getMainInputFilenameForDebugInfoForAtMostOnePrimary(),
|
||||||
getGlobalLLVMContext());
|
"", getGlobalLLVMContext());
|
||||||
runCommandLineSelectedPasses(SILMod, T.second);
|
runCommandLineSelectedPasses(SILMod, T.second);
|
||||||
irgen::deleteIRGenModule(T);
|
irgen::deleteIRGenModule(T);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user