clang-tools 19.0.0git
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.
 

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 425 of file LoopConvertUtils.h.

Member Enumeration Documentation

◆ NamingStyle

Enumerator
NS_CamelBack 
NS_CamelCase 
NS_LowerCase 
NS_UpperCase 

Definition at line 428 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 435 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 842 of file LoopConvertUtils.cpp.

References NS_UpperCase.


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