Skip to content

Commit dfc308c

Browse files
committed
Merge commit 'a1153cd6fedd' from llvm.org/main into next
# Conflicts: # clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp # clang/tools/driver/cc1_main.cpp
2 parents 812a703 + a1153cd commit dfc308c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+134
-192
lines changed

clang-tools-extra/clang-include-fixer/IncludeFixer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ bool IncludeFixerActionFactory::runInvocation(
9595

9696
// Create the compiler's actual diagnostics engine. We want to drop all
9797
// diagnostics here.
98-
Compiler.createDiagnostics(Files->getVirtualFileSystem(),
99-
new clang::IgnoringDiagConsumer,
98+
Compiler.createDiagnostics(new clang::IgnoringDiagConsumer,
10099
/*ShouldOwnClient=*/true);
101100
Compiler.createSourceManager(*Files);
102101

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
110110
CIOpts.VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
111111
CIOpts.CC1Args = CC1Args;
112112
CIOpts.RecoverOnError = true;
113-
CIOpts.Diags = CompilerInstance::createDiagnostics(
114-
*CIOpts.VFS, new DiagnosticOptions, &D, false);
113+
CIOpts.Diags =
114+
CompilerInstance::createDiagnostics(new DiagnosticOptions, &D, false);
115115
CIOpts.ProbePrecompiled = false;
116116
std::unique_ptr<CompilerInvocation> CI = createInvocation(ArgStrs, CIOpts);
117117
if (!CI)
@@ -148,7 +148,7 @@ prepareCompilerInstance(std::unique_ptr<clang::CompilerInvocation> CI,
148148
auto Clang = std::make_unique<CompilerInstance>(
149149
std::make_shared<PCHContainerOperations>());
150150
Clang->setInvocation(std::move(CI));
151-
Clang->createDiagnostics(*VFS, &DiagsClient, false);
151+
Clang->createDiagnostics(&DiagsClient, false);
152152

153153
if (auto VFSWithRemapping = createVFSFromCompilerInvocation(
154154
Clang->getInvocation(), Clang->getDiagnostics(), VFS))

clang-tools-extra/clangd/ModulesBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
188188

189189
clang::clangd::IgnoreDiagnostics IgnoreDiags;
190190
IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
191-
CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions,
192-
&IgnoreDiags,
191+
CompilerInstance::createDiagnostics(new DiagnosticOptions, &IgnoreDiags,
193192
/*ShouldOwnClient=*/false);
194193

195194
LangOptions LangOpts;

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,8 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
613613
for (const auto &L : ASTListeners)
614614
L->sawDiagnostic(D, Diag);
615615
});
616-
auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
617616
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
618-
CompilerInstance::createDiagnostics(*VFS, &CI.getDiagnosticOpts(),
617+
CompilerInstance::createDiagnostics(&CI.getDiagnosticOpts(),
619618
&PreambleDiagnostics,
620619
/*ShouldOwnClient=*/false);
621620
const Config &Cfg = Config::current();
@@ -652,6 +651,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
652651
for (const auto &L : ASTListeners)
653652
L->beforeExecute(CI);
654653
});
654+
auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
655655
llvm::SmallString<32> AbsFileName(FileName);
656656
VFS->makeAbsolute(AbsFileName);
657657
auto StatCache = std::make_shared<PreambleFileStatusCache>(AbsFileName);

clang-tools-extra/include-cleaner/unittests/RecordTest.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -609,24 +609,23 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
609609
)cpp";
610610
Inputs.ExtraFiles["foo.h"] = "";
611611

612-
// Create unnamed memory buffers for all the files.
613-
auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
614-
VFS->addFile(Filename, /*ModificationTime=*/0,
615-
llvm::MemoryBuffer::getMemBufferCopy(Code, /*BufferName=*/""));
616-
for (const auto &Extra : Inputs.ExtraFiles)
617-
VFS->addFile(Extra.getKey(), /*ModificationTime=*/0,
618-
llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(),
619-
/*BufferName=*/""));
620-
621612
auto Clang = std::make_unique<CompilerInstance>(
622613
std::make_shared<PCHContainerOperations>());
623-
Clang->createDiagnostics(*VFS);
614+
Clang->createDiagnostics();
624615

625616
Clang->setInvocation(std::make_unique<CompilerInvocation>());
626617
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(
627618
Clang->getInvocation(), {Filename.data()}, Clang->getDiagnostics(),
628619
"clang"));
629620

621+
// Create unnamed memory buffers for all the files.
622+
auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
623+
VFS->addFile(Filename, /*ModificationTime=*/0,
624+
llvm::MemoryBuffer::getMemBufferCopy(Code, /*BufferName=*/""));
625+
for (const auto &Extra : Inputs.ExtraFiles)
626+
VFS->addFile(Extra.getKey(), /*ModificationTime=*/0,
627+
llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(),
628+
/*BufferName=*/""));
630629
auto *FM = Clang->createFileManager(VFS);
631630
ASSERT_TRUE(Clang->ExecuteAction(*Inputs.MakeAction()));
632631
EXPECT_THAT(

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -725,17 +725,13 @@ class CompilerInstance : public ModuleLoader {
725725
/// Note that this routine also replaces the diagnostic client,
726726
/// allocating one if one is not provided.
727727
///
728-
/// \param VFS is used for any IO needed when creating DiagnosticsEngine. It
729-
/// doesn't replace VFS in the CompilerInstance (if any).
730-
///
731728
/// \param Client If non-NULL, a diagnostic client that will be
732729
/// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
733730
/// unit.
734731
///
735732
/// \param ShouldOwnClient If Client is non-NULL, specifies whether
736733
/// the diagnostic object should take ownership of the client.
737-
void createDiagnostics(llvm::vfs::FileSystem &VFS,
738-
DiagnosticConsumer *Client = nullptr,
734+
void createDiagnostics(DiagnosticConsumer *Client = nullptr,
739735
bool ShouldOwnClient = true);
740736

741737
/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
@@ -756,11 +752,10 @@ class CompilerInstance : public ModuleLoader {
756752
/// used by some diagnostics printers (for logging purposes only).
757753
///
758754
/// \return The new object on success, or null on failure.
759-
static IntrusiveRefCntPtr<DiagnosticsEngine>
760-
createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
761-
DiagnosticConsumer *Client = nullptr,
762-
bool ShouldOwnClient = true,
763-
const CodeGenOptions *CodeGenOpts = nullptr);
755+
static IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(
756+
DiagnosticOptions *Opts, DiagnosticConsumer *Client = nullptr,
757+
bool ShouldOwnClient = true, const CodeGenOptions *CodeGenOpts = nullptr,
758+
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
764759

765760
/// Create the file manager and replace any existing one with it.
766761
///

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -348,20 +348,23 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
348348
}
349349
}
350350

351-
void CompilerInstance::createDiagnostics(llvm::vfs::FileSystem &VFS,
352-
DiagnosticConsumer *Client,
351+
void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
353352
bool ShouldOwnClient) {
354-
Diagnostics = createDiagnostics(VFS, &getDiagnosticOpts(), Client,
355-
ShouldOwnClient, &getCodeGenOpts());
353+
Diagnostics = createDiagnostics(
354+
&getDiagnosticOpts(), Client, ShouldOwnClient, &getCodeGenOpts(),
355+
FileMgr ? FileMgr->getVirtualFileSystemPtr() : nullptr);
356356
}
357357

358358
IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
359-
llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
360-
DiagnosticConsumer *Client, bool ShouldOwnClient,
361-
const CodeGenOptions *CodeGenOpts) {
359+
DiagnosticOptions *Opts, DiagnosticConsumer *Client, bool ShouldOwnClient,
360+
const CodeGenOptions *CodeGenOpts,
361+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
362362
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
363-
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
364-
new DiagnosticsEngine(DiagID, Opts));
363+
IntrusiveRefCntPtr<DiagnosticsEngine>
364+
Diags(new DiagnosticsEngine(DiagID, Opts));
365+
366+
if (!VFS)
367+
VFS = llvm::vfs::getRealFileSystem();
365368

366369
// Create the diagnostic client for reporting errors or for
367370
// implementing -verify.
@@ -385,7 +388,7 @@ IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
385388
Opts->DiagnosticSerializationFile);
386389

387390
// Configure our handling of diagnostics.
388-
ProcessWarningOptions(*Diags, *Opts, VFS);
391+
ProcessWarningOptions(*Diags, *Opts, *VFS);
389392

390393
return Diags;
391394
}
@@ -1398,10 +1401,9 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
13981401
auto &Inv = *Invocation;
13991402
Instance.setInvocation(std::move(Invocation));
14001403

1401-
Instance.createDiagnostics(
1402-
ImportingInstance.getVirtualFileSystem(),
1403-
new ForwardingDiagnosticConsumer(ImportingInstance.getDiagnosticClient()),
1404-
/*ShouldOwnClient=*/true);
1404+
Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
1405+
ImportingInstance.getDiagnosticClient()),
1406+
/*ShouldOwnClient=*/true);
14051407

14061408
if (llvm::is_contained(DiagOpts.SystemHeaderWarningsModules, ModuleName))
14071409
Instance.getDiagnostics().setSuppressSystemWarnings(false);

clang/lib/Frontend/CreateInvocationFromCommandLine.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "llvm/ADT/STLExtras.h"
2323
#include "llvm/ADT/StringRef.h"
2424
#include "llvm/Option/ArgList.h"
25-
#include "llvm/Support/VirtualFileSystem.h"
2625
#include "llvm/TargetParser/Host.h"
2726
using namespace clang;
2827
using namespace llvm::opt;
@@ -33,9 +32,7 @@ clang::createInvocation(ArrayRef<const char *> ArgList,
3332
assert(!ArgList.empty());
3433
auto Diags = Opts.Diags
3534
? std::move(Opts.Diags)
36-
: CompilerInstance::createDiagnostics(
37-
Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(),
38-
new DiagnosticOptions);
35+
: CompilerInstance::createDiagnostics(new DiagnosticOptions);
3936

4037
SmallVector<const char *, 16> Args(ArgList);
4138

clang/lib/Frontend/Rewrite/FrontendActions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ class RewriteIncludesAction::RewriteImportsListener : public ASTReaderListener {
253253
Instance.setInvocation(
254254
std::make_shared<CompilerInvocation>(CI.getInvocation()));
255255
Instance.createDiagnostics(
256-
CI.getVirtualFileSystem(),
257256
new ForwardingDiagnosticConsumer(CI.getDiagnosticClient()),
258257
/*ShouldOwnClient=*/true);
259258
Instance.getFrontendOpts().DisableFree = false;

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "IncrementalExecutor.h"
1616
#include "IncrementalParser.h"
1717
#include "InterpreterUtils.h"
18-
#include "llvm/Support/VirtualFileSystem.h"
1918
#ifdef __EMSCRIPTEN__
2019
#include "Wasm.h"
2120
#endif // __EMSCRIPTEN__
@@ -107,7 +106,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
107106
CompilerInvocation::GetResourcesPath(Argv[0], nullptr);
108107

109108
// Create the actual diagnostics engine.
110-
Clang->createDiagnostics(*llvm::vfs::getRealFileSystem());
109+
Clang->createDiagnostics();
111110
if (!Clang->hasDiagnostics())
112111
return llvm::createStringError(llvm::errc::not_supported,
113112
"Initialization failed. "

clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void ModelInjector::onBodySynthesis(const NamedDecl *D) {
7878
CompilerInstance Instance(CI.getPCHContainerOperations());
7979
Instance.setInvocation(std::move(Invocation));
8080
Instance.createDiagnostics(
81-
CI.getVirtualFileSystem(),
8281
new ForwardingDiagnosticConsumer(CI.getDiagnosticClient()),
8382
/*ShouldOwnClient=*/true);
8483

clang/lib/Testing/TestAST.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class StoreDiagnostics : public DiagnosticConsumer {
5555
// Provides "empty" ASTContext etc if we fail before parsing gets started.
5656
void createMissingComponents(CompilerInstance &Clang) {
5757
if (!Clang.hasDiagnostics())
58-
Clang.createDiagnostics(*llvm::vfs::getRealFileSystem());
58+
Clang.createDiagnostics();
5959
if (!Clang.hasFileManager())
6060
Clang.createFileManager();
6161
if (!Clang.hasSourceManager())
@@ -82,24 +82,9 @@ TestAST::TestAST(const TestInputs &In) {
8282
auto RecoverFromEarlyExit =
8383
llvm::make_scope_exit([&] { createMissingComponents(*Clang); });
8484

85-
std::string Filename = In.FileName;
86-
if (Filename.empty())
87-
Filename = getFilenameForTesting(In.Language).str();
88-
89-
// Set up a VFS with only the virtual file visible.
90-
auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
91-
if (auto Err = VFS->setCurrentWorkingDirectory(In.WorkingDir))
92-
ADD_FAILURE() << "Failed to setWD: " << Err.message();
93-
VFS->addFile(Filename, /*ModificationTime=*/0,
94-
llvm::MemoryBuffer::getMemBufferCopy(In.Code, Filename));
95-
for (const auto &Extra : In.ExtraFiles)
96-
VFS->addFile(
97-
Extra.getKey(), /*ModificationTime=*/0,
98-
llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(), Extra.getKey()));
99-
10085
// Extra error conditions are reported through diagnostics, set that up first.
10186
bool ErrorOK = In.ErrorOK || llvm::StringRef(In.Code).contains("error-ok");
102-
Clang->createDiagnostics(*VFS, new StoreDiagnostics(Diagnostics, !ErrorOK));
87+
Clang->createDiagnostics(new StoreDiagnostics(Diagnostics, !ErrorOK));
10388

10489
// Parse cc1 argv, (typically [-std=c++20 input.cc]) into CompilerInvocation.
10590
std::vector<const char *> Argv;
@@ -108,6 +93,9 @@ TestAST::TestAST(const TestInputs &In) {
10893
Argv.push_back(S.c_str());
10994
for (const auto &S : In.ExtraArgs)
11095
Argv.push_back(S.c_str());
96+
std::string Filename = In.FileName;
97+
if (Filename.empty())
98+
Filename = getFilenameForTesting(In.Language).str();
11199
Argv.push_back(Filename.c_str());
112100
Clang->setInvocation(std::make_unique<CompilerInvocation>());
113101
if (!CompilerInvocation::CreateFromArgs(Clang->getInvocation(), Argv,
@@ -117,6 +105,16 @@ TestAST::TestAST(const TestInputs &In) {
117105
}
118106
assert(!Clang->getInvocation().getFrontendOpts().DisableFree);
119107

108+
// Set up a VFS with only the virtual file visible.
109+
auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
110+
if (auto Err = VFS->setCurrentWorkingDirectory(In.WorkingDir))
111+
ADD_FAILURE() << "Failed to setWD: " << Err.message();
112+
VFS->addFile(Filename, /*ModificationTime=*/0,
113+
llvm::MemoryBuffer::getMemBufferCopy(In.Code, Filename));
114+
for (const auto &Extra : In.ExtraFiles)
115+
VFS->addFile(
116+
Extra.getKey(), /*ModificationTime=*/0,
117+
llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(), Extra.getKey()));
120118
Clang->createFileManager(VFS);
121119

122120
// Running the FrontendAction creates the other components: SourceManager,

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ class DependencyScanningAction : public tooling::ToolAction {
462462
// Create the compiler's actual diagnostics engine.
463463
if (!DiagGenerationAsCompilation)
464464
sanitizeDiagOpts(ScanInstance.getDiagnosticOpts());
465-
ScanInstance.createDiagnostics(DriverFileMgr->getVirtualFileSystem(),
466-
DiagConsumer, /*ShouldOwnClient=*/false);
465+
ScanInstance.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
467466
if (!ScanInstance.hasDiagnostics())
468467
return false;
469468
if (VerboseOS)
@@ -901,7 +900,7 @@ bool DependencyScanningWorker::computeDependencies(
901900
auto DiagOpts = CreateAndPopulateDiagOpts(FinalCCommandLine);
902901
sanitizeDiagOpts(*DiagOpts);
903902
IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
904-
CompilerInstance::createDiagnostics(*FinalFS, DiagOpts.release(), &DC,
903+
CompilerInstance::createDiagnostics(DiagOpts.release(), &DC,
905904
/*ShouldOwnClient=*/false);
906905

907906
// Although `Diagnostics` are used only for command-line parsing, the

clang/lib/Tooling/Tooling.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ bool ToolInvocation::run() {
387387
TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), DiagOpts);
388388
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics =
389389
CompilerInstance::createDiagnostics(
390-
Files->getVirtualFileSystem(), &*DiagOpts,
391-
DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
390+
&*DiagOpts, DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
392391
// Although `Diagnostics` are used only for command-line parsing, the custom
393392
// `DiagConsumer` might expect a `SourceManager` to be present.
394393
SourceManager SrcMgr(*Diagnostics, *Files);
@@ -457,8 +456,7 @@ bool FrontendActionFactory::runInvocation(
457456
std::unique_ptr<FrontendAction> ScopedToolAction(create());
458457

459458
// Create the compiler's actual diagnostics engine.
460-
Compiler.createDiagnostics(Files->getVirtualFileSystem(), DiagConsumer,
461-
/*ShouldOwnClient=*/false);
459+
Compiler.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
462460
if (!Compiler.hasDiagnostics())
463461
return false;
464462

@@ -654,8 +652,7 @@ class ASTBuilderAction : public ToolAction {
654652
DiagnosticConsumer *DiagConsumer) override {
655653
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCompilerInvocation(
656654
Invocation, std::move(PCHContainerOps),
657-
CompilerInstance::createDiagnostics(Files->getVirtualFileSystem(),
658-
&Invocation->getDiagnosticOpts(),
655+
CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(),
659656
DiagConsumer,
660657
/*ShouldOwnClient=*/false),
661658
Files);

clang/tools/c-index-test/core_main.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "llvm/Support/Program.h"
3737
#include "llvm/Support/Signals.h"
3838
#include "llvm/Support/StringSaver.h"
39-
#include "llvm/Support/VirtualFileSystem.h"
4039
#include "llvm/Support/raw_ostream.h"
4140
#include <future>
4241
#include <thread>
@@ -307,9 +306,8 @@ static bool printSourceSymbols(const char *Executable,
307306
SmallVector<const char *, 4> ArgsWithProgName;
308307
ArgsWithProgName.push_back(Executable);
309308
ArgsWithProgName.append(Args.begin(), Args.end());
310-
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
311-
CompilerInstance::createDiagnostics(*llvm::vfs::getRealFileSystem(),
312-
new DiagnosticOptions));
309+
IntrusiveRefCntPtr<DiagnosticsEngine>
310+
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
313311
CreateInvocationOptions CIOpts;
314312
CIOpts.Diags = Diags;
315313
CIOpts.ProbePrecompiled = true; // FIXME: historical default. Needed?
@@ -362,8 +360,7 @@ static bool printSourceSymbolsFromModule(StringRef modulePath,
362360
auto HSOpts = std::make_shared<HeaderSearchOptions>();
363361

364362
IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
365-
CompilerInstance::createDiagnostics(*llvm::vfs::getRealFileSystem(),
366-
new DiagnosticOptions());
363+
CompilerInstance::createDiagnostics(new DiagnosticOptions());
367364
std::unique_ptr<ASTUnit> AU =
368365
ASTUnit::LoadFromASTFile(modulePath, *pchRdr, ASTUnit::LoadASTOnly, Diags,
369366
FileSystemOpts, HSOpts, /*LangOpts=*/nullptr,

clang/tools/clang-import-test/clang-import-test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "llvm/Support/CommandLine.h"
3232
#include "llvm/Support/Error.h"
3333
#include "llvm/Support/Signals.h"
34-
#include "llvm/Support/VirtualFileSystem.h"
3534
#include "llvm/TargetParser/Host.h"
3635

3736
#include <memory>
@@ -165,8 +164,7 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance() {
165164
auto Ins = std::make_unique<CompilerInstance>();
166165
auto DC = std::make_unique<TestDiagnosticConsumer>();
167166
const bool ShouldOwnClient = true;
168-
Ins->createDiagnostics(*llvm::vfs::getRealFileSystem(), DC.release(),
169-
ShouldOwnClient);
167+
Ins->createDiagnostics(DC.release(), ShouldOwnClient);
170168

171169
auto Inv = std::make_unique<CompilerInvocation>();
172170

0 commit comments

Comments
 (0)