Skip to content

Commit

Permalink
[clang-tidy][NFC] Fix modernize-use-using findings
Browse files Browse the repository at this point in the history
Fix issues found by clang-tidy in clang-tidy source directory.
  • Loading branch information
PiotrZSL committed Aug 27, 2023
1 parent ac80017 commit 87c4113
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/ClangTidy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
}
}

typedef std::vector<std::pair<std::string, bool>> CheckersList;
using CheckersList = std::vector<std::pair<std::string, bool>>;

static CheckersList getAnalyzerCheckersAndPackages(ClangTidyContext &Context,
bool IncludeExperimental) {
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/ClangTidyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ClangTidyCheckFactories {
std::vector<std::unique_ptr<ClangTidyCheck>>
createChecksForLanguage(ClangTidyContext *Context) const;

typedef llvm::StringMap<CheckFactory> FactoryMap;
using FactoryMap = llvm::StringMap<CheckFactory>;
FactoryMap::const_iterator begin() const { return Factories.begin(); }
FactoryMap::const_iterator end() const { return Factories.end(); }
bool empty() const { return Factories.empty(); }
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace clang::tidy {

typedef llvm::Registry<ClangTidyModule> ClangTidyModuleRegistry;
using ClangTidyModuleRegistry = llvm::Registry<ClangTidyModule>;

} // namespace clang::tidy

Expand Down
18 changes: 8 additions & 10 deletions clang-tools-extra/clang-tidy/ClangTidyOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct FileFilter {
std::string Name;

/// LineRange is a pair<start, end> (inclusive).
typedef std::pair<unsigned, unsigned> LineRange;
using LineRange = std::pair<unsigned int, unsigned int>;

/// A list of line ranges in this file, for which we show warnings.
std::vector<LineRange> LineRanges;
Expand Down Expand Up @@ -118,13 +118,13 @@ struct ClangTidyOptions {
/// files to disambiguate local vs global value from different levels.
unsigned Priority = 0;
};
typedef std::pair<std::string, std::string> StringPair;
typedef llvm::StringMap<ClangTidyValue> OptionMap;
using StringPair = std::pair<std::string, std::string>;
using OptionMap = llvm::StringMap<ClangTidyValue>;

/// Key-value mapping used to store check-specific options.
OptionMap CheckOptions;

typedef std::vector<std::string> ArgList;
using ArgList = std::vector<std::string>;

/// Add extra compilation arguments to the end of the list.
std::optional<ArgList> ExtraArgs;
Expand Down Expand Up @@ -165,7 +165,7 @@ class ClangTidyOptionsProvider {
/// commandline option is specified, clang-tidy will ignore the
/// configuration file.
/// * '-checks' commandline option.
typedef std::pair<ClangTidyOptions, std::string> OptionsSource;
using OptionsSource = std::pair<ClangTidyOptions, std::string>;

/// Returns an ordered vector of OptionsSources, in order of increasing
/// priority.
Expand Down Expand Up @@ -199,9 +199,7 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
protected:
// A pair of configuration file base name and a function parsing
// configuration from text in the corresponding format.
typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
llvm::MemoryBufferRef)>>
ConfigFileHandler;
using ConfigFileHandler = std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions> (llvm::MemoryBufferRef)>>;

/// Configuration file handlers listed in the order of priority.
///
Expand All @@ -220,7 +218,7 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
///
/// With the order of handlers shown above, the ".my-tidy-config" file would
/// take precedence over ".clang-tidy" if both reside in the same directory.
typedef std::vector<ConfigFileHandler> ConfigFileHandlers;
using ConfigFileHandlers = std::vector<ConfigFileHandler>;

FileOptionsBaseProvider(ClangTidyGlobalOptions GlobalOptions,
ClangTidyOptions DefaultOptions,
Expand All @@ -232,7 +230,7 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
ClangTidyOptions OverrideOptions,
ConfigFileHandlers ConfigHandlers);

protected:
protected:
void addRawFileOptions(llvm::StringRef AbsolutePath,
std::vector<OptionsSource> &CurOptions);

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/FileExtensionsSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "llvm/ADT/StringRef.h"

namespace clang::tidy {
typedef llvm::SmallSet<llvm::StringRef, 5> FileExtensionsSet;
using FileExtensionsSet = llvm::SmallSet<llvm::StringRef, 5>;
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FILE_EXTENSIONS_SET_H
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class IncludeOrderPPCallbacks : public PPCallbacks {
bool IsMainModule; ///< true if this was the first include in a file
};

typedef std::vector<IncludeDirective> FileIncludes;
using FileIncludes = std::vector<IncludeDirective>;
std::map<clang::FileID, FileIncludes> IncludeDirectives;
bool LookForMainModule;

Expand Down
20 changes: 10 additions & 10 deletions clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ enum LoopFixerKind {
};

/// A map used to walk the AST in reverse: maps child Stmt to parent Stmt.
typedef llvm::DenseMap<const clang::Stmt *, const clang::Stmt *> StmtParentMap;
using StmtParentMap = llvm::DenseMap<const clang::Stmt *, const clang::Stmt *>;

/// A map used to walk the AST in reverse:
/// maps VarDecl to the to parent DeclStmt.
typedef llvm::DenseMap<const clang::VarDecl *, const clang::DeclStmt *>
DeclParentMap;
using DeclParentMap =
llvm::DenseMap<const clang::VarDecl *, const clang::DeclStmt *>;

/// A map used to track which variables have been removed by a refactoring pass.
/// It maps the parent ForStmt to the removed index variable's VarDecl.
typedef llvm::DenseMap<const clang::ForStmt *, const clang::VarDecl *>
ReplacedVarsMap;
using ReplacedVarsMap =
llvm::DenseMap<const clang::ForStmt *, const clang::VarDecl *>;

/// A map used to remember the variable names generated in a Stmt
typedef llvm::DenseMap<const clang::Stmt *, std::string>
StmtGeneratedVarNameMap;
using StmtGeneratedVarNameMap =
llvm::DenseMap<const clang::Stmt *, std::string>;

/// A vector used to store the AST subtrees of an Expr.
typedef llvm::SmallVector<const clang::Expr *, 16> ComponentVector;
using ComponentVector = llvm::SmallVector<const clang::Expr *, 16>;

/// Class used build the reverse AST properties needed to detect
/// name conflicts and free variables.
Expand Down Expand Up @@ -270,7 +270,7 @@ class Confidence {
};

// The main computational result of ForLoopIndexVisitor.
typedef llvm::SmallVector<Usage, 8> UsageResult;
using UsageResult = llvm::SmallVector<Usage, 8>;

// General functions used by ForLoopIndexUseVisitor and LoopConvertCheck.
const Expr *digThroughConstructorsConversions(const Expr *E);
Expand Down Expand Up @@ -339,7 +339,7 @@ class ForLoopIndexUseVisitor

private:
/// Typedef used in CRTP functions.
typedef RecursiveASTVisitor<ForLoopIndexUseVisitor> VisitorBase;
using VisitorBase = RecursiveASTVisitor<ForLoopIndexUseVisitor>;
friend class RecursiveASTVisitor<ForLoopIndexUseVisitor>;

/// Overriden methods for RecursiveASTVisitor's traversal.
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/utils/IncludeSorter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class IncludeSorter {
bool IsAngled);

private:
typedef SmallVector<SourceRange, 1> SourceRangeVector;
using SourceRangeVector = SmallVector<SourceRange, 1>;

const SourceManager *SourceMgr;
const IncludeStyle Style;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/utils/UsingInserter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class UsingInserter {
llvm::StringRef QualifiedName);

private:
typedef std::pair<const FunctionDecl *, std::string> NameInFunction;
using NameInFunction = std::pair<const FunctionDecl *, std::string>;
const SourceManager &SourceMgr;
std::set<NameInFunction> AddedUsing;
};
Expand Down

0 comments on commit 87c4113

Please sign in to comment.