absolute_node_id.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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_SEM_IR_ABSOLUTE_NODE_ID_H_
  5. #define CARBON_TOOLCHAIN_SEM_IR_ABSOLUTE_NODE_ID_H_
  6. #include "toolchain/parse/tree_and_subtrees.h"
  7. #include "toolchain/sem_ir/file.h"
  8. #include "toolchain/sem_ir/ids.h"
  9. namespace Carbon::SemIR {
  10. // A specific node location in a file.
  11. struct AbsoluteNodeId {
  12. CheckIRId check_ir_id;
  13. Parse::NodeId node_id;
  14. };
  15. // Resolves the `InstId` to a series of `NodeId`s, which may be in different
  16. // files. The vector will have one entry if there were no imports, and multiple
  17. // entries when imports are traversed. The final entry is the actual
  18. // declaration.
  19. auto GetAbsoluteNodeId(const File* sem_ir, InstId inst_id)
  20. -> llvm::SmallVector<AbsoluteNodeId>;
  21. // Similar to to above overload, but starting at a `LocId`.
  22. auto GetAbsoluteNodeId(const File* sem_ir, LocId loc_id)
  23. -> llvm::SmallVector<AbsoluteNodeId>;
  24. } // namespace Carbon::SemIR
  25. #endif // CARBON_TOOLCHAIN_SEM_IR_ABSOLUTE_NODE_ID_H_