[clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC.

llvm-svn: 349148
This commit is contained in:
Haojian Wu 2018-12-14 13:49:00 +00:00
parent 02c8343c75
commit 941ce02deb
1 changed files with 4 additions and 10 deletions

View File

@ -44,17 +44,11 @@ private:
auto VFS = FS.getFileSystem();
VFS->setCurrentWorkingDirectory(Cmd->Directory);
std::vector<const char *> Argv;
for (const auto &S : Cmd->CommandLine)
Argv.push_back(S.c_str());
auto CI = clang::createInvocationFromCommandLine(
Argv,
CompilerInstance::createDiagnostics(new DiagnosticOptions(),
&IgnoreDiags, false),
VFS);
ParseInputs PI;
PI.CompileCommand = *Cmd;
PI.FS = VFS;
auto CI = buildCompilerInvocation(PI);
EXPECT_TRUE(static_cast<bool>(CI));
CI->getFrontendOpts().DisableFree = false;
// The diagnostic options must be set before creating a CompilerInstance.
CI->getDiagnosticOpts().IgnoreWarnings = true;
auto Clang = prepareCompilerInstance(