Skip to content

Commit 8e6b87c

Browse files
committed
[Clang] Fix compile error
rdar://140448660
1 parent 6ed901f commit 8e6b87c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

clang/tools/clang-cas-test/ClangCASTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ int main(int Argc, const char **Argv) {
6868
}
6969

7070
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
71-
CompilerInstance::createDiagnostics(new DiagnosticOptions));
71+
CompilerInstance::createDiagnostics(*llvm::vfs::getRealFileSystem(),
72+
new DiagnosticOptions));
7273

7374
CASOptions Opts;
7475
// Printing a cache key only makes sense in an existing CAS, so default to

clang/tools/driver/CacheLauncherMode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ static bool shouldCacheInvocation(ArrayRef<const char *> Args,
4444
CreateInvocationOptions Opts;
4545
// Ignore diagnostic parsing diagnostics; if they are real issues they will be
4646
// seen when compiling. Just fallback to disabling caching here.
47-
Opts.Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions,
48-
new IgnoringDiagConsumer);
47+
Opts.Diags = CompilerInstance::createDiagnostics(
48+
*llvm::vfs::getRealFileSystem(), new DiagnosticOptions,
49+
new IgnoringDiagConsumer);
4950
// This enables picking the first invocation in a multi-arch build.
5051
Opts.RecoverOnError = true;
5152
std::shared_ptr<CompilerInvocation> CInvok =

clang/tools/libclang/Driver.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ clang_Driver_getExternalActionsForCommand_v0(int ArgC, const char **ArgV,
4242

4343
CXDiagnosticSetDiagnosticConsumer DiagConsumer;
4444
auto DiagOpts = CreateAndPopulateDiagOpts(ArrayRef(ArgV, ArgC));
45-
auto Diags = CompilerInstance::createDiagnostics(DiagOpts.release(),
46-
&DiagConsumer, false);
4745

4846
// Use createPhysicalFileSystem instead of getRealFileSystem so that
4947
// setCurrentWorkingDirectory doesn't change the working directory of the
5048
// process.
5149
std::unique_ptr<llvm::vfs::FileSystem> VFS =
5250
llvm::vfs::createPhysicalFileSystem();
51+
52+
auto Diags = CompilerInstance::createDiagnostics(*VFS, DiagOpts.release(),
53+
&DiagConsumer, false);
5354
if (WorkingDirectory)
5455
if (std::error_code EC =
5556
VFS->setCurrentWorkingDirectory(WorkingDirectory)) {

0 commit comments

Comments
 (0)