absolute_node_id.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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 `LocId` 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. //
  20. // Note that the `LocId` here is typically not canonical, and it uses that fact
  21. // for non-canonical locations built from an `ExportDecl` instruction.
  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_