@@ -791,10 +791,9 @@ static bool compileLLVMIR(CompilerInstance &Instance) {
791
791
inputsAndOutputs.getFilenameOfFirstInput ());
792
792
793
793
if (!FileBufOrErr) {
794
- Instance.getASTContext ().Diags .diagnose (
795
- SourceLoc (), diag::error_open_input_file,
796
- inputsAndOutputs.getFilenameOfFirstInput (),
797
- FileBufOrErr.getError ().message ());
794
+ Instance.getDiags ().diagnose (SourceLoc (), diag::error_open_input_file,
795
+ inputsAndOutputs.getFilenameOfFirstInput (),
796
+ FileBufOrErr.getError ().message ());
798
797
return true ;
799
798
}
800
799
llvm::MemoryBuffer *MainFile = FileBufOrErr.get ().get ();
@@ -806,9 +805,9 @@ static bool compileLLVMIR(CompilerInstance &Instance) {
806
805
if (!Module) {
807
806
// TODO: Translate from the diagnostic info to the SourceManager location
808
807
// if available.
809
- Instance.getASTContext ().Diags . diagnose (
810
- SourceLoc (), diag::error_parse_input_file ,
811
- inputsAndOutputs. getFilenameOfFirstInput (), Err.getMessage ());
808
+ Instance.getDiags ().diagnose (SourceLoc (), diag::error_parse_input_file,
809
+ inputsAndOutputs. getFilenameOfFirstInput () ,
810
+ Err.getMessage ());
812
811
return true ;
813
812
}
814
813
return performLLVM (Invocation.getIRGenOptions (), Instance.getASTContext (),
@@ -927,7 +926,7 @@ static void emitReferenceDependenciesForAllPrimaryInputsIfNeeded(
927
926
if (Invocation.getFrontendOptions ()
928
927
.InputsAndOutputs .hasReferenceDependenciesPath () &&
929
928
Instance.getPrimarySourceFiles ().empty ()) {
930
- Instance.getASTContext (). Diags .diagnose (
929
+ Instance.getDiags () .diagnose (
931
930
SourceLoc (), diag::emit_reference_dependencies_without_primary_file);
932
931
return ;
933
932
}
@@ -936,48 +935,47 @@ static void emitReferenceDependenciesForAllPrimaryInputsIfNeeded(
936
935
Invocation.getReferenceDependenciesFilePathForPrimary (
937
936
SF->getFilename ());
938
937
if (!referenceDependenciesFilePath.empty ()) {
939
- auto LangOpts = Invocation.getLangOptions ();
938
+ const auto LangOpts = Invocation.getLangOptions ();
940
939
(void )fine_grained_dependencies::emitReferenceDependencies (
941
- Instance.getASTContext ().Diags , SF,
942
- *Instance.getDependencyTracker (),
940
+ Instance.getDiags (), SF, *Instance.getDependencyTracker (),
943
941
referenceDependenciesFilePath,
944
942
LangOpts.EmitFineGrainedDependencySourcefileDotFiles );
945
943
}
946
944
}
947
945
}
948
946
static void
949
- emitSwiftRangesForAllPrimaryInputsIfNeeded (const CompilerInstance &Instance) {
947
+ emitSwiftRangesForAllPrimaryInputsIfNeeded (CompilerInstance &Instance) {
950
948
const auto &Invocation = Instance.getInvocation ();
951
949
if (Invocation.getFrontendOptions ().InputsAndOutputs .hasSwiftRangesPath () &&
952
950
Instance.getPrimarySourceFiles ().empty ()) {
953
- Instance.getASTContext ().Diags . diagnose (
954
- SourceLoc (), diag::emit_swift_ranges_without_primary_file);
951
+ Instance.getDiags ().diagnose (SourceLoc (),
952
+ diag::emit_swift_ranges_without_primary_file);
955
953
return ;
956
954
}
957
955
for (auto *SF : Instance.getPrimarySourceFiles ()) {
958
956
const std::string &swiftRangesFilePath =
959
957
Invocation.getSwiftRangesFilePathForPrimary (SF->getFilename ());
960
958
if (!swiftRangesFilePath.empty ()) {
961
- (void )Instance.emitSwiftRanges (Instance.getASTContext (). Diags , SF,
959
+ (void )Instance.emitSwiftRanges (Instance.getDiags () , SF,
962
960
swiftRangesFilePath);
963
961
}
964
962
}
965
963
}
966
964
static void emitCompiledSourceForAllPrimaryInputsIfNeeded (
967
- const CompilerInstance &Instance) {
965
+ CompilerInstance &Instance) {
968
966
const auto &Invocation = Instance.getInvocation ();
969
967
if (Invocation.getFrontendOptions ()
970
968
.InputsAndOutputs .hasCompiledSourcePath () &&
971
969
Instance.getPrimarySourceFiles ().empty ()) {
972
- Instance.getASTContext (). Diags .diagnose (
970
+ Instance.getDiags () .diagnose (
973
971
SourceLoc (), diag::emit_compiled_source_without_primary_file);
974
972
return ;
975
973
}
976
974
for (auto *SF : Instance.getPrimarySourceFiles ()) {
977
975
const std::string &compiledSourceFilePath =
978
976
Invocation.getCompiledSourceFilePathForPrimary (SF->getFilename ());
979
977
if (!compiledSourceFilePath.empty ()) {
980
- (void )Instance.emitCompiledSource (Instance.getASTContext (). Diags , SF,
978
+ (void )Instance.emitCompiledSource (Instance.getDiags () , SF,
981
979
compiledSourceFilePath);
982
980
}
983
981
}
@@ -1037,9 +1035,8 @@ static bool writeLdAddCFileIfNeeded(CompilerInstance &Instance) {
1037
1035
std::error_code EC;
1038
1036
llvm::raw_fd_ostream OS (Path, EC, llvm::sys::fs::F_None);
1039
1037
if (EC) {
1040
- module ->getASTContext ().Diags .diagnose (SourceLoc (),
1041
- diag::error_opening_output,
1042
- Path, EC.message ());
1038
+ Instance.getDiags ().diagnose (SourceLoc (), diag::error_opening_output, Path,
1039
+ EC.message ());
1043
1040
return true ;
1044
1041
}
1045
1042
OS << " // Automatically generated C source file from the Swift compiler \n "
@@ -1254,7 +1251,7 @@ static bool performCompile(CompilerInstance &Instance,
1254
1251
scanDependencies (Instance);
1255
1252
}
1256
1253
1257
- (void )emitMakeDependenciesIfNeeded (Context. Diags ,
1254
+ (void )emitMakeDependenciesIfNeeded (Instance. getDiags () ,
1258
1255
Instance.getDependencyTracker (), opts);
1259
1256
1260
1257
if (Action == FrontendOptions::ActionType::ResolveImports ||
0 commit comments