clang  6.0.0svn
Public Types | Public Member Functions | List of all members
clang::tooling::SymbolOccurrence Class Reference

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
SymbolOccurrenceoperator= (SymbolOccurrence &&)=default
OccurrenceKind getKind () const
ArrayRef< SourceRangegetNameRanges () const

Detailed Description

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:

[object selectorPiece1: ... selectorPiece2: ...];
// ^~~ range 0 ~~ ^~~ range 1 ~~

We have to replace the text in both range 0 and range 1 when renaming the Objective-C method 'selectorPiece1:selectorPiece2'.

Definition at line 40 of file SymbolOccurrences.h.

Member Enumeration Documentation

◆ OccurrenceKind


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 42 of file SymbolOccurrences.h.

Constructor & Destructor Documentation

◆ SymbolOccurrence() [1/2]

SymbolOccurrence::SymbolOccurrence ( const SymbolName Name,
OccurrenceKind  Kind,
ArrayRef< SourceLocation Locations 

Definition at line 17 of file SymbolOccurrences.cpp.

◆ SymbolOccurrence() [2/2]

clang::tooling::SymbolOccurrence::SymbolOccurrence ( SymbolOccurrence &&  )

Member Function Documentation

◆ getKind()

OccurrenceKind clang::tooling::SymbolOccurrence::getKind ( ) const

Definition at line 70 of file SymbolOccurrences.h.

◆ getNameRanges()

ArrayRef<SourceRange> clang::tooling::SymbolOccurrence::getNameRanges ( ) const

◆ operator=()

SymbolOccurrence& clang::tooling::SymbolOccurrence::operator= ( SymbolOccurrence &&  )

The documentation for this class was generated from the following files: