Silence an "illegal conversion" diagnostic

MSVC was issuing "illegal conversion; more than one user-defined
conversion has been implicitly applied" as a warning on this code.
Explicitly calling .str() causes a StringRef to be materialized so
that a second user-defined conversion is not required.
This commit is contained in:
Aaron Ballman 2022-06-27 12:02:34 -04:00
parent 92fd2eb74f
commit 9878e17624
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ llvm::Optional<std::string> queryXcrun(llvm::ArrayRef<llvm::StringRef> Argv) {
llvm::sys::fs::createTemporaryFile("clangd-xcrun", "", OutFile);
llvm::FileRemover OutRemover(OutFile);
llvm::Optional<llvm::StringRef> Redirects[3] = {
/*stdin=*/{""}, /*stdout=*/{OutFile}, /*stderr=*/{""}};
/*stdin=*/{""}, /*stdout=*/{OutFile.str()}, /*stderr=*/{""}};
vlog("Invoking {0} to find clang installation", *Xcrun);
int Ret = llvm::sys::ExecuteAndWait(*Xcrun, Argv,
/*Env=*/llvm::None, Redirects,