This patch adds new member function to DependencyScanningWorker that allows clients to pass custom DiagnosticConsumer, and returns bool.
This provides more flexibility compared to the existing version that automatically stringifies diagnostics and returns them in llvm::Error.