Clang Project

clang_source_code/include/clang/Tooling/Core/Lookup.h
1//===--- Lookup.h - Framework for clang refactoring tools --*- C++ -*------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//  This file defines helper methods for clang tools performing name lookup.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_TOOLING_CORE_LOOKUP_H
14#define LLVM_CLANG_TOOLING_CORE_LOOKUP_H
15
16#include "clang/Basic/LLVM.h"
17#include <string>
18
19namespace clang {
20
21class DeclContext;
22class NamedDecl;
23class NestedNameSpecifier;
24
25namespace tooling {
26
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 UseContext The context in which the nested name is contained. This
34///                   will be used to minimize namespace qualifications.
35/// \param FromDecl The declaration to which the nested name points.
36/// \param ReplacementString The replacement nested name. Must be fully
37///                          qualified including a leading "::".
38/// \returns The new name to be inserted in place of the current nested name.
39std::string replaceNestedName(const NestedNameSpecifier *Use,
40                              const DeclContext *UseContext,
41                              const NamedDecl *FromDecl,
42                              StringRef ReplacementString);
43
44// end namespace tooling
45// end namespace clang
46
47#endif // LLVM_CLANG_TOOLING_CORE_LOOKUP_H
48