cpp_file.cpp 658 B

12345678910111213141516171819
  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. #include "toolchain/sem_ir/cpp_file.h"
  5. namespace Carbon::SemIR {
  6. auto CppFile::VisitLocalTopLevelDecls(
  7. llvm::function_ref<void(const clang::Decl*)> visitor) const -> void {
  8. ast_unit_->visitLocalTopLevelDecls(
  9. &visitor, [](void* erased_visitor_ptr, const clang::Decl* decl) {
  10. auto* visitor_ptr = static_cast<decltype(visitor)*>(erased_visitor_ptr);
  11. (*visitor_ptr)(decl);
  12. return true;
  13. });
  14. }
  15. } // namespace Carbon::SemIR