From 941ce02deb3911b429387e2b97d270de4c257732 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 14 Dec 2018 13:49:00 +0000 Subject: [PATCH] [clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC. llvm-svn: 349148 --- clang-tools-extra/unittests/clangd/HeadersTests.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/clang-tools-extra/unittests/clangd/HeadersTests.cpp b/clang-tools-extra/unittests/clangd/HeadersTests.cpp index 4c8ef07..bd28f71 100644 --- a/clang-tools-extra/unittests/clangd/HeadersTests.cpp +++ b/clang-tools-extra/unittests/clangd/HeadersTests.cpp @@ -44,17 +44,11 @@ private: auto VFS = FS.getFileSystem(); VFS->setCurrentWorkingDirectory(Cmd->Directory); - std::vector 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(CI)); - CI->getFrontendOpts().DisableFree = false; - // The diagnostic options must be set before creating a CompilerInstance. CI->getDiagnosticOpts().IgnoreWarnings = true; auto Clang = prepareCompilerInstance( -- 2.7.4