Files
carbon-lang/toolchain/sem_ir/entry_point.cpp
T
Jon Ross-PerkinsandRichard Smith 949cc21ccc Remove SemIR:: from most sem_ir files (#5358)
This is just cleanup, at least some from LocId replacements.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2025-04-25 16:06:10 +00:00

23 lines
769 B
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
#include "toolchain/sem_ir/entry_point.h"
#include "llvm/ADT/StringRef.h"
namespace Carbon::SemIR {
static constexpr llvm::StringLiteral EntryPointFunction = "Run";
auto IsEntryPoint(const File& file, FunctionId function_id) -> bool {
// TODO: Check if `file` is in the `Main` package.
const auto& function = file.functions().Get(function_id);
// TODO: Check if `function` is in a namespace.
return function.name_id.has_value() &&
file.names().GetAsStringIfIdentifier(function.name_id) ==
EntryPointFunction;
}
} // namespace Carbon::SemIR