mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 14:12:42 +00:00
This was to track use of a declaration after import, prior to a redeclaration. Per [discussion on Discord](https://discord.com/channels/655572317891461132/1217182321933815820/1236016521059237962), we likely don't need this check due to the change in behavior of `extern`. Rather than potentially getting one of many `extern` decls and depending on it by accident, it is now planned to be _required_ to be imported, and the library doing a non-`extern` decl must _know_ it's importing the `extern` decl. The stricter requirement on the library means it now seems more reasonable to use the `extern` decl. So kind of rolling back #3831, though keeping `ImportIRInstId` (at least for now) and keeping `Loaded`/`Unloaded` terminology (seems a nicer fit).
37 lines
1.3 KiB
C++
37 lines
1.3 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_IMPORT_REF_H_
|
|
#define CARBON_TOOLCHAIN_CHECK_IMPORT_REF_H_
|
|
|
|
#include "toolchain/check/context.h"
|
|
#include "toolchain/sem_ir/file.h"
|
|
#include "toolchain/sem_ir/ids.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
// Sets the IR for ImportIRId::ApiForImpl. Should be called before AddImportIR
|
|
// in order to ensure the correct ID is assigned.
|
|
auto SetApiImportIR(Context& context, SemIR::ImportIR import_ir) -> void;
|
|
|
|
// Adds an ImportIR, returning the ID. May use an existing ID if already added.
|
|
auto AddImportIR(Context& context, SemIR::ImportIR import_ir)
|
|
-> SemIR::ImportIRId;
|
|
|
|
// Adds an import_ref instruction for the specified instruction in the
|
|
// specified IR. The import_ref is initially marked as unused.
|
|
auto AddImportRef(Context& context, SemIR::ImportIRInst import_ir_inst)
|
|
-> SemIR::InstId;
|
|
|
|
// If the passed in instruction ID is an ImportRefUnloaded, turns it into an
|
|
// ImportRefLoaded for use.
|
|
auto LoadImportRef(Context& context, SemIR::InstId inst_id) -> void;
|
|
|
|
// Load all impls declared in IRs imported into this context.
|
|
auto ImportImpls(Context& context) -> void;
|
|
|
|
} // namespace Carbon::Check
|
|
|
|
#endif // CARBON_TOOLCHAIN_CHECK_IMPORT_REF_H_
|