clang 22.0.0git
|
An occurrence of a symbol in the source. More...
#include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
Public Types | |
enum | OccurrenceKind { MatchingSymbol } |
Public Member Functions | |
SymbolOccurrence (const SymbolName &Name, OccurrenceKind Kind, ArrayRef< SourceLocation > Locations) | |
SymbolOccurrence (SymbolOccurrence &&)=default | |
SymbolOccurrence & | operator= (SymbolOccurrence &&)=default |
OccurrenceKind | getKind () const |
ArrayRef< SourceRange > | getNameRanges () const |
An occurrence of a symbol in the source.
Occurrences can have difference kinds, that describe whether this occurrence is an exact semantic match, or whether this is a weaker textual match that's not guaranteed to represent the exact declaration.
A single occurrence of a symbol can span more than one source range. For example, Objective-C selectors can contain multiple argument labels:
We have to replace the text in both range 0 and range 1 when renaming the Objective-C method 'selectorPiece1:selectorPiece2'.
Definition at line 39 of file SymbolOccurrences.h.
Enumerator | |
---|---|
MatchingSymbol | This occurrence is an exact match and can be renamed automatically. Note: Symbol occurrences in macro arguments that expand to different declarations get marked as exact matches, and thus the renaming engine will rename them e.g.: #define MACRO(x) x + ns::x
int foo(int var) {
return MACRO(var); // var is renamed automatically here when
// either var or ns::var is renamed.
};
The user will have to fix their code manually after performing such a rename. FIXME: The rename verifier should notify user about this issue. |
Definition at line 41 of file SymbolOccurrences.h.
SymbolOccurrence::SymbolOccurrence | ( | const SymbolName & | Name, |
OccurrenceKind | Kind, | ||
ArrayRef< SourceLocation > | Locations ) |
Definition at line 16 of file SymbolOccurrences.cpp.
References clang::tooling::SymbolName::getNamePieces(), NumRanges, and SingleRange.
Referenced by operator=(), and SymbolOccurrence().
|
default |
References SymbolOccurrence().
|
inline |
Definition at line 69 of file SymbolOccurrences.h.
|
inline |
Definition at line 71 of file SymbolOccurrences.h.
References NumRanges, and SingleRange.
|
default |
References SymbolOccurrence().
unsigned clang::tooling::SymbolOccurrence::NumRanges |
Definition at line 82 of file SymbolOccurrences.h.
Referenced by getNameRanges(), and SymbolOccurrence().
SourceRange clang::tooling::SymbolOccurrence::SingleRange |
Definition at line 81 of file SymbolOccurrences.h.
Referenced by getNameRanges(), and SymbolOccurrence().