@@ -1016,33 +1016,17 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
1016
1016
const SemaCompleteInput &Input,
1017
1017
IncludeStructure *Includes = nullptr ) {
1018
1018
trace::Span Tracer (" Sema completion" );
1019
- std::vector<const char *> ArgStrs;
1020
- for (const auto &S : Input.Command .CommandLine )
1021
- ArgStrs.push_back (S.c_str ());
1022
-
1023
- if (Input.VFS ->setCurrentWorkingDirectory (Input.Command .Directory )) {
1024
- log (" Couldn't set working directory" );
1025
- // We run parsing anyway, our lit-tests rely on results for non-existing
1026
- // working dirs.
1027
- }
1028
-
1029
1019
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = Input.VFS ;
1030
1020
if (Input.Preamble && Input.Preamble ->StatCache )
1031
1021
VFS = Input.Preamble ->StatCache ->getConsumingFS (std::move (VFS));
1032
- IgnoreDiagnostics DummyDiagsConsumer;
1033
- auto CI = createInvocationFromCommandLine (
1034
- ArgStrs,
1035
- CompilerInstance::createDiagnostics (new DiagnosticOptions,
1036
- &DummyDiagsConsumer, false ),
1037
- VFS);
1022
+ auto CI =
1023
+ buildCompilerInvocation (ParseInputs{Input.Command , VFS, Input.Contents });
1038
1024
if (!CI) {
1039
1025
elog (" Couldn't create CompilerInvocation" );
1040
1026
return false ;
1041
1027
}
1042
1028
auto &FrontendOpts = CI->getFrontendOpts ();
1043
- FrontendOpts.DisableFree = false ;
1044
1029
FrontendOpts.SkipFunctionBodies = true ;
1045
- CI->getLangOpts ()->CommentOpts .ParseAllComments = true ;
1046
1030
// Disable typo correction in Sema.
1047
1031
CI->getLangOpts ()->SpellChecking = false ;
1048
1032
// Setup code completion.
@@ -1072,6 +1056,7 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
1072
1056
*Offset;
1073
1057
// NOTE: we must call BeginSourceFile after prepareCompilerInstance. Otherwise
1074
1058
// the remapped buffers do not get freed.
1059
+ IgnoreDiagnostics DummyDiagsConsumer;
1075
1060
auto Clang = prepareCompilerInstance (
1076
1061
std::move (CI),
1077
1062
(Input.Preamble && !CompletingInPreamble) ? &Input.Preamble ->Preamble
0 commit comments