clang 20.0.0git
USRLocFinder.h
Go to the documentation of this file.
1//===--- USRLocFinder.h - Clang refactoring library -----------------------===//
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/// \file
10/// Provides functionality for finding all instances of a USR in a given
11/// AST.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
16#define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
17
18#include "clang/AST/AST.h"
22#include "llvm/ADT/StringRef.h"
23#include <string>
24#include <vector>
25
26namespace clang {
27namespace tooling {
28
29/// Create atomic changes for renaming all symbol references which are
30/// identified by the USRs set to a given new name.
31///
32/// \param USRs The set containing USRs of a particular old symbol.
33/// \param NewName The new name to replace old symbol name.
34/// \param TranslationUnitDecl The translation unit declaration.
35///
36/// \return Atomic changes for renaming.
37std::vector<tooling::AtomicChange>
39 llvm::StringRef NewName, Decl *TranslationUnitDecl);
40
41/// Finds the symbol occurrences for the symbol that's identified by the given
42/// USR set.
43///
44/// \return SymbolOccurrences that can be converted to AtomicChanges when
45/// renaming.
46SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
47 StringRef PrevName, Decl *Decl);
48
49} // end namespace tooling
50} // end namespace clang
51
52#endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
SymbolOccurrences getOccurrencesOfUSRs(ArrayRef< std::string > USRs, StringRef PrevName, Decl *Decl)
Finds the symbol occurrences for the symbol that's identified by the given USR set.
std::vector< SymbolOccurrence > SymbolOccurrences
std::vector< tooling::AtomicChange > createRenameAtomicChanges(llvm::ArrayRef< std::string > USRs, llvm::StringRef NewName, Decl *TranslationUnitDecl)
Create atomic changes for renaming all symbol references which are identified by the USRs set to a gi...
The JSON file list parser is used to communicate input to InstallAPI.