From 87c4113708b88ef20d3cac96e2fd43e5c3eabf91 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Sat, 26 Aug 2023 17:28:06 +0000 Subject: [PATCH] [clang-tidy][NFC] Fix modernize-use-using findings Fix issues found by clang-tidy in clang-tidy source directory. --- clang-tools-extra/clang-tidy/ClangTidy.cpp | 2 +- .../clang-tidy/ClangTidyModule.h | 2 +- .../clang-tidy/ClangTidyModuleRegistry.h | 2 +- .../clang-tidy/ClangTidyOptions.h | 18 ++++++++--------- .../clang-tidy/FileExtensionsSet.h | 2 +- .../clang-tidy/llvm/IncludeOrderCheck.cpp | 2 +- .../clang-tidy/modernize/LoopConvertUtils.h | 20 +++++++++---------- .../clang-tidy/utils/IncludeSorter.h | 2 +- .../clang-tidy/utils/UsingInserter.h | 2 +- 9 files changed, 25 insertions(+), 27 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 3fd1153eb721..ca48388e85a9 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> CheckersList; +using CheckersList = std::vector>; 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 0e55c1ef9dfe..28f54331755a 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyModule.h +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.h @@ -70,7 +70,7 @@ public: std::vector> createChecksForLanguage(ClangTidyContext *Context) const; - typedef llvm::StringMap FactoryMap; + using FactoryMap = llvm::StringMap; 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 30ffe1818431..78d914bfedbc 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 ClangTidyModuleRegistry; +using ClangTidyModuleRegistry = llvm::Registry; } // namespace clang::tidy diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.h b/clang-tools-extra/clang-tidy/ClangTidyOptions.h index b3b714353642..e20a7d734a19 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 (inclusive). - typedef std::pair LineRange; + using LineRange = std::pair; /// A list of line ranges in this file, for which we show warnings. std::vector LineRanges; @@ -118,13 +118,13 @@ struct ClangTidyOptions { /// files to disambiguate local vs global value from different levels. unsigned Priority = 0; }; - typedef std::pair StringPair; - typedef llvm::StringMap OptionMap; + using StringPair = std::pair; + using OptionMap = llvm::StringMap; /// Key-value mapping used to store check-specific options. OptionMap CheckOptions; - typedef std::vector ArgList; + using ArgList = std::vector; /// Add extra compilation arguments to the end of the list. std::optional ExtraArgs; @@ -165,7 +165,7 @@ public: /// commandline option is specified, clang-tidy will ignore the /// configuration file. /// * '-checks' commandline option. - typedef std::pair OptionsSource; + using OptionsSource = std::pair; /// 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( - llvm::MemoryBufferRef)>> - ConfigFileHandler; + using ConfigFileHandler = std::pair (llvm::MemoryBufferRef)>>; /// Configuration file handlers listed in the order of priority. /// @@ -220,7 +218,7 @@ protected: /// /// 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 ConfigFileHandlers; + using ConfigFileHandlers = std::vector; FileOptionsBaseProvider(ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions, @@ -232,7 +230,7 @@ protected: ClangTidyOptions OverrideOptions, ConfigFileHandlers ConfigHandlers); -protected: + protected: void addRawFileOptions(llvm::StringRef AbsolutePath, std::vector &CurOptions); diff --git a/clang-tools-extra/clang-tidy/FileExtensionsSet.h b/clang-tools-extra/clang-tidy/FileExtensionsSet.h index 417b1b69f11f..7ca4e6ee01d3 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 FileExtensionsSet; +using FileExtensionsSet = llvm::SmallSet; } // 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 3bfd6676f4b1..b76a3702a03d 100644 --- a/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp @@ -40,7 +40,7 @@ private: bool IsMainModule; ///< true if this was the first include in a file }; - typedef std::vector FileIncludes; + using FileIncludes = std::vector; std::map IncludeDirectives; bool LookForMainModule; diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h index 54f129038ba8..624d72c66630 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 StmtParentMap; +using StmtParentMap = llvm::DenseMap; /// A map used to walk the AST in reverse: /// maps VarDecl to the to parent DeclStmt. -typedef llvm::DenseMap - DeclParentMap; +using DeclParentMap = + llvm::DenseMap; /// 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 - ReplacedVarsMap; +using ReplacedVarsMap = + llvm::DenseMap; /// A map used to remember the variable names generated in a Stmt -typedef llvm::DenseMap - StmtGeneratedVarNameMap; +using StmtGeneratedVarNameMap = + llvm::DenseMap; /// A vector used to store the AST subtrees of an Expr. -typedef llvm::SmallVector ComponentVector; +using ComponentVector = llvm::SmallVector; /// Class used build the reverse AST properties needed to detect /// name conflicts and free variables. @@ -270,7 +270,7 @@ private: }; // The main computational result of ForLoopIndexVisitor. -typedef llvm::SmallVector UsageResult; +using UsageResult = llvm::SmallVector; // General functions used by ForLoopIndexUseVisitor and LoopConvertCheck. const Expr *digThroughConstructorsConversions(const Expr *E); @@ -339,7 +339,7 @@ public: private: /// Typedef used in CRTP functions. - typedef RecursiveASTVisitor VisitorBase; + using VisitorBase = RecursiveASTVisitor; friend class RecursiveASTVisitor; /// 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 5f954af596da..782fa6721bc0 100644 --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h @@ -51,7 +51,7 @@ public: bool IsAngled); private: - typedef SmallVector SourceRangeVector; + using SourceRangeVector = SmallVector; 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 04274f247074..7ff1f0b9792e 100644 --- a/clang-tools-extra/clang-tidy/utils/UsingInserter.h +++ b/clang-tools-extra/clang-tidy/utils/UsingInserter.h @@ -37,7 +37,7 @@ public: llvm::StringRef QualifiedName); private: - typedef std::pair NameInFunction; + using NameInFunction = std::pair; const SourceManager &SourceMgr; std::set AddedUsing; };