[clang-tools-extra] 9878e17 - Silence an "illegal conversion" diagnostic
    Aaron Ballman via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Jun 27 09:04:12 PDT 2022
    
    
  
Author: Aaron Ballman
Date: 2022-06-27T12:04:01-04:00
New Revision: 9878e17624d811965f46661a095d6a8b1fc8e110
URL: https://github.com/llvm/llvm-project/commit/9878e17624d811965f46661a095d6a8b1fc8e110
DIFF: https://github.com/llvm/llvm-project/commit/9878e17624d811965f46661a095d6a8b1fc8e110.diff
LOG: 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.
Added: 
    
Modified: 
    clang-tools-extra/clangd/CompileCommands.cpp
Removed: 
    
################################################################################
diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index 491b713793536..39198d0711998 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -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,
        
    
    
More information about the cfe-commits
mailing list