1 //===--- Lookup.h - Framework for clang refactoring tools --*- C++ -*------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines helper methods for clang tools performing name lookup.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_TOOLING_CORE_LOOKUP_H
15 #define LLVM_CLANG_TOOLING_CORE_LOOKUP_H
16 
17 #include "clang/Basic/LLVM.h"
18 #include <string>
19 
20 namespace clang {
21 
22 class DeclContext;
23 class NamedDecl;
24 class NestedNameSpecifier;
25 
26 namespace tooling {
27 
28 /// Emulate a lookup to replace one nested name specifier with another using as
29 /// few additional namespace qualifications as possible.
30 ///
31 /// This does not perform a full C++ lookup so ADL will not work.
32 ///
33 /// \param Use The nested 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                               const DeclContext *UseContext,
42                               const NamedDecl *FromDecl,
43                               StringRef ReplacementString);
44 
45 } // end namespace tooling
46 } // end namespace clang
47 
48 #endif // LLVM_CLANG_TOOLING_CORE_LOOKUP_H
49