lib/Driver/ToolChains.cpp
static bool findXcodeClangPath(llvm::SmallVectorImpl<char> &path) {
  assert(path.empty());

  auto xcrunPath = llvm::sys::findProgramByName("xcrun");
  if (!xcrunPath.getError()) {
    const char *args[] = {"-f", "clang", nullptr};
    sys::TaskQueue queue;
    queue.addTask(xcrunPath->c_str(), args, /*Env=*/llvm::None,
                  /*Context=*/nullptr,
                  /*SeparateErrors=*/true);
    queue.execute(nullptr, [&path](sys::ProcessId PID, int returnCode,
                                   StringRef output, StringRef errors,
                                   void *unused) -> sys::TaskFinishedResponse {
      if (returnCode == 0) {
        output = output.rtrim();
        path.append(output.begin(), output.end());
      }
      return sys::TaskFinishedResponse::ContinueExecution;
    });
  }

  return !path.empty();
}
/// Runs <code>xcrun -f clang</code> in order to find the location of Clang for
/// the currently active Xcode.
///
/// We get the "currently active" part by passing through the DEVELOPER_DIR
/// environment variable (along with the rest of the environment).
Runs xcrun -f clang in order to find the location of Clang for
the currently active Xcode.

We get the "currently active" part by passing through the DEVELOPER_DIR
environment variable (along with the rest of the environment).
Runs xcrun - f clang in order to find the location of Clang for the currently active Xcode . We get the " currently active " part by passing through the DEVELOPER_DIR environment variable ( along with the rest of the environment ) .
static bool findXcodeClangPath(llvm::SmallVectorImpl<char> &path) {
  assert(path.empty());
  auto xcrunPath = llvm::sys::findProgramByName("xcrun");
  if (!xcrunPath.getError()) {
    const char *args[] = {"-f", "clang", nullptr};
    sys::TaskQueue queue;
    queue.addTask(xcrunPath->c_str(), args, llvm::None,
                  nullptr,
                  true);
    queue.execute(nullptr, [&path](sys::ProcessId PID, int returnCode,
                                   StringRef output, StringRef errors,
                                   void *unused) -> sys::TaskFinishedResponse {
      if (returnCode == 0) {
        output = output.rtrim();
        path.append(output.begin(), output.end());
      }
      return sys::TaskFinishedResponse::ContinueExecution;
    });
  }
  return !path.empty();
}
static bool findXcodeClangPath ( llvm :: SmallVectorImpl < char > & path ) { assert ( path . empty ( ) ) ; auto xcrunPath = llvm :: sys :: findProgramByName ( " " ) ; if ( ! xcrunPath . getError ( ) ) { const char * args [ ] = { " " , " " , nullptr } ; sys :: TaskQueue queue ; queue . addTask ( xcrunPath -> c_str ( ) , args , llvm :: None , nullptr , true ) ; queue . execute ( nullptr , [ & path ] ( sys :: ProcessId PID , int returnCode , StringRef output , StringRef errors , void * unused ) -> sys :: TaskFinishedResponse { if ( returnCode == 0 ) { output = output . rtrim ( ) ; path . append ( output . begin ( ) , output . end ( ) ) ; } return sys :: TaskFinishedResponse :: ContinueExecution ; } ) ; } return ! path . empty ( ) ; }
Runs <code>xcrun -f clang</code> in order to find the location of Clang for
the currently active Xcode.
Runs <code > xcrun - f clang< / code > in order to find the location of Clang for the currently active Xcode .
/*Env=*/ /*Context=*/ /*SeparateErrors=*/