clang-tools 6.0.0

Public Types | Public Member Functions | List of all members
clang::tidy::modernize::VariableNamer Class Reference

Create names for generated variables within a particular statement. More...

`#include <LoopConvertUtils.h>`

## Public Types
enum | NamingStyle { NS_CamelBack, NS_CamelCase, NS_LowerCase, NS_UpperCase }

## Public Member Functions
| VariableNamer (StmtGeneratedVarNameMap *GeneratedDecls, const StmtParentMap *ReverseAST, const clang::Stmt *SourceStmt, const clang::VarDecl *OldIndex, const clang::ValueDecl *TheContainer, const clang::ASTContext *Context, NamingStyle Style)
std::string | createIndexName ()
| Generate a new index name. More...

## Detailed Description

Create names for generated variables within a particular statement.

VariableNamer uses a DeclContext as a reference point, checking for any conflicting declarations higher up in the context or within SourceStmt. It creates a variable name using hints from a source container and the old index, if they exist.

Definition at line 423 of file LoopConvertUtils.h.

## Member Enumeration Documentation

## ◆ NamingStyle

enum clang::tidy::modernize::VariableNamer::NamingStyle

Enumerator
NS_CamelBack |
NS_CamelCase |
NS_LowerCase |
NS_UpperCase |

Definition at line 426 of file LoopConvertUtils.h.

## Constructor & Destructor Documentation

## ◆ VariableNamer()

clang::tidy::modernize::VariableNamer::VariableNamer | ( | StmtGeneratedVarNameMap * | GeneratedDecls,
|  | const StmtParentMap * | ReverseAST,
|  | const clang::Stmt * | SourceStmt,
|  | const clang::VarDecl * | OldIndex,
|  | const clang::ValueDecl * | TheContainer,
|  | const clang::ASTContext * | Context,
|  | NamingStyle | Style
| ) |  |
| inline

Definition at line 433 of file LoopConvertUtils.h.

## Member Function Documentation

## ◆ createIndexName()

std::string clang::tidy::modernize::VariableNamer::createIndexName | ( |  | ) |

Generate a new index name.

Generates the name to be used for an inserted iterator. It relies on declarationExists() to determine that there are no naming conflicts, and tries to use some hints from the container name and the old index name.

Definition at line 844 of file LoopConvertUtils.cpp.

References clang::tidy::modernize::DeclFinderASTVisitor::findUsages().

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

- LoopConvertUtils.h
- LoopConvertUtils.cpp