Lookup.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- Lookup.h - Framework for clang refactoring tools --*- C++ -*------===//
  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. // This file defines helper methods for clang tools performing name lookup.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CLANG_TOOLING_REFACTORING_LOOKUP_H
  18. #define LLVM_CLANG_TOOLING_REFACTORING_LOOKUP_H
  19. #include "clang/Basic/LLVM.h"
  20. #include "clang/Basic/SourceLocation.h"
  21. #include <string>
  22. namespace clang {
  23. class DeclContext;
  24. class NamedDecl;
  25. class NestedNameSpecifier;
  26. namespace tooling {
  27. /// Emulate a lookup to replace one nested name specifier with another using as
  28. /// few additional namespace qualifications as possible.
  29. ///
  30. /// This does not perform a full C++ lookup so ADL will not work.
  31. ///
  32. /// \param Use The nested name to be replaced.
  33. /// \param UseLoc The location of name to be replaced.
  34. /// \param UseContext The context in which the nested name is contained. This
  35. /// will be used to minimize namespace qualifications.
  36. /// \param FromDecl The declaration to which the nested name points.
  37. /// \param ReplacementString The replacement nested name. Must be fully
  38. /// qualified including a leading "::".
  39. /// \returns The new name to be inserted in place of the current nested name.
  40. std::string replaceNestedName(const NestedNameSpecifier *Use,
  41. SourceLocation UseLoc,
  42. const DeclContext *UseContext,
  43. const NamedDecl *FromDecl,
  44. StringRef ReplacementString);
  45. } // end namespace tooling
  46. } // end namespace clang
  47. #endif // LLVM_CLANG_TOOLING_REFACTORING_LOOKUP_H
  48. #ifdef __GNUC__
  49. #pragma GCC diagnostic pop
  50. #endif