[clang-tools-extra] 87c4113 - [clang-tidy][NFC] Fix modernize-use-using findings
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 27 01:53:39 PDT 2023
Author: Piotr Zegar
Date: 2023-08-27T08:52:10Z
New Revision: 87c4113708b88ef20d3cac96e2fd43e5c3eabf91
URL: https://github.com/llvm/llvm-project/commit/87c4113708b88ef20d3cac96e2fd43e5c3eabf91
DIFF: https://github.com/llvm/llvm-project/commit/87c4113708b88ef20d3cac96e2fd43e5c3eabf91.diff
LOG: [clang-tidy][NFC] Fix modernize-use-using findings
Fix issues found by clang-tidy in clang-tidy source directory.
Added:
Modified:
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang-tools-extra/clang-tidy/ClangTidyModule.h
clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
clang-tools-extra/clang-tidy/ClangTidyOptions.h
clang-tools-extra/clang-tidy/FileExtensionsSet.h
clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
clang-tools-extra/clang-tidy/utils/IncludeSorter.h
clang-tools-extra/clang-tidy/utils/UsingInserter.h
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 3fd1153eb721a9..ca48388e85a99e 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -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) {
diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.h b/clang-tools-extra/clang-tidy/ClangTidyModule.h
index 0e55c1ef9dfead..28f54331755a7a 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyModule.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyModule.h
@@ -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(); }
diff --git a/clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h b/clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
index 30ffe1818431be..78d914bfedbc94 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
@@ -14,7 +14,7 @@
namespace clang::tidy {
-typedef llvm::Registry<ClangTidyModule> ClangTidyModuleRegistry;
+using ClangTidyModuleRegistry = llvm::Registry<ClangTidyModule>;
} // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.h b/clang-tools-extra/clang-tidy/ClangTidyOptions.h
index b3b714353642bd..e20a7d734a199c 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyOptions.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.h
@@ -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;
@@ -118,13 +118,13 @@ struct ClangTidyOptions {
/// files to disambiguate local vs global value from
diff erent 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;
@@ -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.
@@ -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.
///
@@ -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,
@@ -232,7 +230,7 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
ClangTidyOptions OverrideOptions,
ConfigFileHandlers ConfigHandlers);
-protected:
+ protected:
void addRawFileOptions(llvm::StringRef AbsolutePath,
std::vector<OptionsSource> &CurOptions);
diff --git a/clang-tools-extra/clang-tidy/FileExtensionsSet.h b/clang-tools-extra/clang-tidy/FileExtensionsSet.h
index 417b1b69f11f7f..7ca4e6ee01d3f2 100644
--- a/clang-tools-extra/clang-tidy/FileExtensionsSet.h
+++ b/clang-tools-extra/clang-tidy/FileExtensionsSet.h
@@ -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
diff --git a/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp b/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
index 3bfd6676f4b130..b76a3702a03d4a 100644
--- a/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
@@ -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;
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
index 54f129038ba81f..624d72c666304f 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
@@ -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.
@@ -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);
@@ -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.
diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h
index 5f954af596da11..782fa6721bc03c 100644
--- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h
+++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h
@@ -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;
diff --git a/clang-tools-extra/clang-tidy/utils/UsingInserter.h b/clang-tools-extra/clang-tidy/utils/UsingInserter.h
index 04274f24707443..7ff1f0b9792e13 100644
--- a/clang-tools-extra/clang-tidy/utils/UsingInserter.h
+++ b/clang-tools-extra/clang-tidy/utils/UsingInserter.h
@@ -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;
};
More information about the cfe-commits
mailing list