unused.h 914 B

1234567891011121314151617181920212223
  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_CHECK_UNUSED_H_
  5. #define CARBON_TOOLCHAIN_CHECK_UNUSED_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/check/scope_stack.h"
  8. namespace Carbon::Check {
  9. // Checks for an unused binding. We track whether a name was declared in a
  10. // reachable position, and whether it was used (even in unreachable code), to
  11. // decide whether to warn. If a name is used in unreachable code, we don't warn
  12. // because changing it to `_` would be a name lookup error in that unreachable
  13. // code.
  14. auto CheckUnusedBinding(Context& context, SemIR::NameId name_id,
  15. const LexicalLookup::Result& result) -> void;
  16. } // namespace Carbon::Check
  17. #endif // CARBON_TOOLCHAIN_CHECK_UNUSED_H_