clang_invocation.h 1.1 KB

12345678910111213141516171819202122232425262728
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TOOLCHAIN_BASE_CLANG_INVOCATION_H_
  5. #define CARBON_TOOLCHAIN_BASE_CLANG_INVOCATION_H_
  6. #include <string>
  7. #include "clang/Frontend/CompilerInvocation.h"
  8. #include "llvm/ADT/ArrayRef.h"
  9. #include "llvm/ADT/IntrusiveRefCntPtr.h"
  10. #include "llvm/Support/VirtualFileSystem.h"
  11. #include "toolchain/diagnostics/diagnostic_emitter.h"
  12. namespace Carbon {
  13. // Builds and returns a clang `CompilerInvocation` to use when building code for
  14. // interop, from a list of clang driver arguments. Emits diagnostics to
  15. // `consumer` if the arguments are invalid.
  16. auto BuildClangInvocation(Diagnostics::Consumer& consumer,
  17. llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
  18. llvm::ArrayRef<std::string> clang_path_and_args)
  19. -> std::unique_ptr<clang::CompilerInvocation>;
  20. } // namespace Carbon
  21. #endif // CARBON_TOOLCHAIN_BASE_CLANG_INVOCATION_H_