@@ -127,7 +127,7 @@ getFileOutputStream(StringRef OutputFilename, ASTContext &Ctx) {
127
127
}
128
128
129
129
// / Writes the Syntax tree to the given file
130
- static bool emitSyntax (SourceFile &SF, StringRef OutputFilename) {
130
+ static bool emitSyntax (const SourceFile &SF, StringRef OutputFilename) {
131
131
auto os = getFileOutputStream (OutputFilename, SF.getASTContext ());
132
132
if (!os) return true ;
133
133
@@ -221,8 +221,8 @@ class JSONFixitWriter
221
221
public:
222
222
JSONFixitWriter (std::string fixitsOutputPath,
223
223
const DiagnosticOptions &DiagOpts)
224
- : FixitsOutputPath(fixitsOutputPath),
225
- FixitAll (DiagOpts.FixitCodeForAllDiagnostics) {}
224
+ : FixitsOutputPath(std::move( fixitsOutputPath) ),
225
+ FixitAll (DiagOpts.FixitCodeForAllDiagnostics) {}
226
226
227
227
private:
228
228
void handleDiagnostic (SourceManager &SM,
@@ -1612,10 +1612,13 @@ static void emitIndexDataForSourceFile(SourceFile *PrimarySourceFile,
1612
1612
if (moduleToken.empty ())
1613
1613
moduleToken = opts.InputsAndOutputs .getSingleOutputFilename ();
1614
1614
1615
- (void ) index::indexAndRecord (Instance.getMainModule (), opts.InputsAndOutputs .copyOutputFilenames (),
1615
+ (void ) index::indexAndRecord (Instance.getMainModule (),
1616
+ opts.InputsAndOutputs .copyOutputFilenames (),
1616
1617
moduleToken, opts.IndexStorePath ,
1617
- opts.IndexSystemModules , opts.IndexIgnoreStdlib ,
1618
- isDebugCompilation, Invocation.getTargetTriple (),
1618
+ opts.IndexSystemModules ,
1619
+ opts.IndexIgnoreStdlib ,
1620
+ isDebugCompilation,
1621
+ Invocation.getTargetTriple (),
1619
1622
*Instance.getDependencyTracker ());
1620
1623
}
1621
1624
}
@@ -1683,11 +1686,12 @@ createSerializedDiagnosticConsumerIfNeeded(
1683
1686
return createDispatchingDiagnosticConsumerIfNeeded (
1684
1687
inputsAndOutputs,
1685
1688
[](const InputFile &input) -> std::unique_ptr<DiagnosticConsumer> {
1686
- std::string serializedDiagnosticsPath = input.serializedDiagnosticsPath ();
1687
- if (serializedDiagnosticsPath.empty ())
1688
- return nullptr ;
1689
- return serialized_diagnostics::createConsumer (serializedDiagnosticsPath);
1690
- });
1689
+ auto serializedDiagnosticsPath = input.getSerializedDiagnosticsPath ();
1690
+ if (serializedDiagnosticsPath.empty ())
1691
+ return nullptr ;
1692
+ return serialized_diagnostics::createConsumer (
1693
+ serializedDiagnosticsPath);
1694
+ });
1691
1695
}
1692
1696
1693
1697
// / Creates a diagnostic consumer that handles serializing diagnostics, based on
@@ -1704,12 +1708,12 @@ createJSONFixItDiagnosticConsumerIfNeeded(
1704
1708
return createDispatchingDiagnosticConsumerIfNeeded (
1705
1709
invocation.getFrontendOptions ().InputsAndOutputs ,
1706
1710
[&](const InputFile &input) -> std::unique_ptr<DiagnosticConsumer> {
1707
- std::string fixItsOutputPath = input.fixItsOutputPath ();
1708
- if (fixItsOutputPath.empty ())
1709
- return nullptr ;
1710
- return std::make_unique<JSONFixitWriter>(
1711
- fixItsOutputPath, invocation.getDiagnosticOptions ());
1712
- });
1711
+ auto fixItsOutputPath = input.getFixItsOutputPath ();
1712
+ if (fixItsOutputPath.empty ())
1713
+ return nullptr ;
1714
+ return std::make_unique<JSONFixitWriter>(
1715
+ fixItsOutputPath. str () , invocation.getDiagnosticOptions ());
1716
+ });
1713
1717
}
1714
1718
1715
1719
// / Print information about a
0 commit comments