Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:11

0001 //===--- USRLocFinder.h - Clang refactoring library -----------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// \file
0010 /// Provides functionality for finding all instances of a USR in a given
0011 /// AST.
0012 ///
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
0016 #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
0017 
0018 #include "clang/AST/AST.h"
0019 #include "clang/Tooling/Core/Replacement.h"
0020 #include "clang/Tooling/Refactoring/AtomicChange.h"
0021 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
0022 #include "llvm/ADT/StringRef.h"
0023 #include <string>
0024 #include <vector>
0025 
0026 namespace clang {
0027 namespace tooling {
0028 
0029 /// Create atomic changes for renaming all symbol references which are
0030 /// identified by the USRs set to a given new name.
0031 ///
0032 /// \param USRs The set containing USRs of a particular old symbol.
0033 /// \param NewName The new name to replace old symbol name.
0034 /// \param TranslationUnitDecl The translation unit declaration.
0035 ///
0036 /// \return Atomic changes for renaming.
0037 std::vector<tooling::AtomicChange>
0038 createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
0039                           llvm::StringRef NewName, Decl *TranslationUnitDecl);
0040 
0041 /// Finds the symbol occurrences for the symbol that's identified by the given
0042 /// USR set.
0043 ///
0044 /// \return SymbolOccurrences that can be converted to AtomicChanges when
0045 /// renaming.
0046 SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
0047                                        StringRef PrevName, Decl *Decl);
0048 
0049 } // end namespace tooling
0050 } // end namespace clang
0051 
0052 #endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H