Files
carbon-lang/toolchain/check/check.h
T
Jon Ross-Perkins 20c20595ba Fix language-server crash with cpp_ast (#5604)
Removes the nullptr default for safety.

Note, I think cpp support doesn't allow things like `<version>` or
inline code yet, and language-server support doesn't allow non-hermetic
files, so the best I can test is an error.
2025-06-03 22:09:51 +00:00

46 lines
1.6 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_TOOLCHAIN_CHECK_CHECK_H_
#define CARBON_TOOLCHAIN_CHECK_CHECK_H_
#include "common/ostream.h"
#include "toolchain/base/shared_value_stores.h"
#include "toolchain/base/timings.h"
#include "toolchain/check/diagnostic_emitter.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"
#include "toolchain/parse/tree_and_subtrees.h"
#include "toolchain/sem_ir/file.h"
namespace Carbon::Check {
// Checking information that's tracked per file. All members are caller-owned.
// Other than `timings`, members must be non-null.
struct Unit {
Diagnostics::Consumer* consumer;
SharedValueStores* value_stores;
// The `timings` may be null if nothing is to be recorded.
Timings* timings;
// The unit's SemIR, provided as empty and filled in by CheckParseTrees.
SemIR::File* sem_ir;
// Storage for the unit's Clang AST. The unique_ptr should start empty, and
// can be assigned as part of checking.
std::unique_ptr<clang::ASTUnit>* cpp_ast;
};
// Checks a group of parse trees. This will use imports to decide the order of
// checking.
auto CheckParseTrees(
llvm::MutableArrayRef<Unit> units,
llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters,
bool prelude_import, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
llvm::StringRef target, llvm::raw_ostream* vlog_stream, bool fuzzing)
-> void;
} // namespace Carbon::Check
#endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_