USRFinder.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- USRFinder.h - Clang refactoring library --------------------------===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. ///
  14. /// \file
  15. /// Methods for determining the USR of a symbol at a location in source
  16. /// code.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
  20. #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
  21. #include "clang/AST/AST.h"
  22. #include "clang/AST/ASTContext.h"
  23. #include <string>
  24. #include <vector>
  25. namespace clang {
  26. class ASTContext;
  27. class Decl;
  28. class SourceLocation;
  29. class NamedDecl;
  30. namespace tooling {
  31. // Given an AST context and a point, returns a NamedDecl identifying the symbol
  32. // at the point. Returns null if nothing is found at the point.
  33. const NamedDecl *getNamedDeclAt(const ASTContext &Context,
  34. const SourceLocation Point);
  35. // Given an AST context and a fully qualified name, returns a NamedDecl
  36. // identifying the symbol with a matching name. Returns null if nothing is
  37. // found for the name.
  38. const NamedDecl *getNamedDeclFor(const ASTContext &Context,
  39. const std::string &Name);
  40. // Converts a Decl into a USR.
  41. std::string getUSRForDecl(const Decl *Decl);
  42. } // end namespace tooling
  43. } // end namespace clang
  44. #endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif