mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:21:04 +01:00
This is (far) from robust -- particularly with repeated compiles in the same address space. But it appears to be sufficient in the short term, and we already have the relevant TODOs to factor this upstream into something that we can use here. This also somehow uncovered a bug in how we were logging failed commands -- the failed commands are destroyed when we destroy the driver object (and its diagnostics object), so we simply cannot do the logging _after_ flushing diagnostics. That's probably ok, and just doing this in the other order makes the code simpler. Assisted-by: Antigravity with Gemini
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_THIRD_PARTY_LLVM_CLANG_CC1_H_
|
|
#define CARBON_THIRD_PARTY_LLVM_CLANG_CC1_H_
|
|
|
|
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
|
#include "llvm/ADT/SmallVector.h"
|
|
#include "llvm/Support/VirtualFileSystem.h"
|
|
#include "toolchain/base/install_paths.h"
|
|
|
|
namespace Carbon {
|
|
|
|
// Emulates Clang's `cc1_main` but in a way that doesn't assume it is running
|
|
// in the main thread and can more easily fit into library calls to do
|
|
// compiles.
|
|
//
|
|
// TODO: Much of the logic here should be factored out of the CC1
|
|
// implementation in Clang's driver and into a reusable part of its libraries.
|
|
// That should allow reducing the code here to a minimal amount.
|
|
auto RunClangCC1Main(const InstallPaths& installation,
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
|
llvm::SmallVectorImpl<const char*>& cc1_args,
|
|
bool enable_leaking) -> int;
|
|
|
|
} // namespace Carbon
|
|
|
|
#endif // CARBON_THIRD_PARTY_LLVM_CLANG_CC1_H_
|