jroelofs updated this revision to Diff 248757. jroelofs added a comment. - Drop dead include.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75621/new/ https://reviews.llvm.org/D75621 Files: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.h clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h clang-tools-extra/clang-tidy/utils/HeaderGuard.h clang-tools-extra/docs/ReleaseNotes.rst
Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -125,6 +125,11 @@ check now detects in class initializers and constructor initializers which are deemed to be redundant. +- Checks supporting the ``HeaderFileExtensions`` flag now support ``;`` as a + delimiter in addition to ``,``, with the latter being deprecated as of this + release. This simplifies how one specifies the options on the command line: + ``--config="{CheckOptions: [{ key: HeaderFileExtensions, value: h;;hpp;hxx }]}"`` + Renamed checks ^^^^^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.h =================================================================== --- clang-tools-extra/clang-tidy/utils/HeaderGuard.h +++ clang-tools-extra/clang-tidy/utils/HeaderGuard.h @@ -18,11 +18,12 @@ /// Finds and fixes header guards. /// The check supports these options: -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of -/// header files (The filename extension should not contain "." prefix). -/// ",h,hh,hpp,hxx" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (The filename extension should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +/// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. class HeaderGuardCheck : public ClangTidyCheck { public: HeaderGuardCheck(StringRef Name, ClangTidyContext *Context) @@ -30,7 +31,8 @@ RawStringHeaderFileExtensions(Options.getLocalOrGlobal( "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) { utils::parseFileExtensions(RawStringHeaderFileExtensions, - HeaderFileExtensions, ','); + HeaderFileExtensions, + utils::defaultFileExtensionDelimiters()); } void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override; Index: clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h =================================================================== --- clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h +++ clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h @@ -34,11 +34,16 @@ /// Returns recommended default value for the list of header file /// extensions. -inline StringRef defaultHeaderFileExtensions() { return ",h,hh,hpp,hxx"; } +inline StringRef defaultHeaderFileExtensions() { return ";h;hh;hpp;hxx"; } + +/// Returns recommended default value for the list of file extension +/// delimiters. +inline StringRef defaultFileExtensionDelimiters() { return ",;"; } /// Parses header file extensions from a semicolon-separated list. bool parseFileExtensions(StringRef AllFileExtensions, - FileExtensionsSet &FileExtensions, char Delimiter); + FileExtensionsSet &FileExtensions, + StringRef Delimiters); /// Decides whether a file has one of the specified file extensions. bool isFileExtension(StringRef FileName, Index: clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp =================================================================== --- clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp +++ clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp @@ -33,9 +33,16 @@ } bool parseFileExtensions(StringRef AllFileExtensions, - FileExtensionsSet &FileExtensions, char Delimiter) { + FileExtensionsSet &FileExtensions, + StringRef Delimiters) { SmallVector<StringRef, 5> Suffixes; - AllFileExtensions.split(Suffixes, Delimiter); + for (char Delimiter : Delimiters) { + if (AllFileExtensions.contains(Delimiter)) { + AllFileExtensions.split(Suffixes, Delimiter); + break; + } + } + FileExtensions.clear(); for (StringRef Suffix : Suffixes) { StringRef Extension = Suffix.trim(); Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h =================================================================== --- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h +++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h @@ -22,11 +22,12 @@ /// The check supports these options: /// - `UseHeaderFileExtension`: Whether to use file extension to distinguish /// header files. True by default. -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of -/// header files (The filename extension should not contain "." prefix). -/// ",h,hh,hpp,hxx" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (The filename extension should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +/// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. /// /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/misc-definitions-in-headers.html Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -34,7 +34,8 @@ RawStringHeaderFileExtensions(Options.getLocalOrGlobal( "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) { if (!utils::parseFileExtensions(RawStringHeaderFileExtensions, - HeaderFileExtensions, ',')) { + HeaderFileExtensions, + utils::defaultFileExtensionDelimiters())) { // FIXME: Find a more suitable way to handle invalid configuration // options. llvm::errs() << "Invalid header file extension: " Index: clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.h =================================================================== --- clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.h +++ clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.h @@ -19,11 +19,12 @@ /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html /// The check supports these options: -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of -/// header files (The filename extension should not contain "." prefix). -/// ",h,hh,hpp,hxx" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (The filename extension should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +/// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck { public: LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context); Index: clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h =================================================================== --- clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h +++ clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h @@ -20,11 +20,12 @@ /// Finds anonymous namespaces in headers. /// /// The check supports these options: -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of -/// header files (The filename extensions should not contain "." prefix). -/// "h,hh,hpp,hxx" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (The filename extensions should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +/// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. /// /// https://google.github.io/styleguide/cppguide.html#Namespaces /// Index: clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp +++ clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp @@ -24,7 +24,8 @@ RawStringHeaderFileExtensions(Options.getLocalOrGlobal( "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) { if (!utils::parseFileExtensions(RawStringHeaderFileExtensions, - HeaderFileExtensions, ',')) { + HeaderFileExtensions, + utils::defaultFileExtensionDelimiters())) { llvm::errs() << "Invalid header file extension: " << RawStringHeaderFileExtensions << "\n"; } Index: clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h =================================================================== --- clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h +++ clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h @@ -21,11 +21,12 @@ /// Right now it only triggers on using declarations and directives. /// /// The check supports these options: -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions -/// of header files (the filename extensions should not contain "." prefix). -/// "h" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (the filename extensions should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +/// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. class GlobalNamesInHeadersCheck : public ClangTidyCheck { public: GlobalNamesInHeadersCheck(StringRef Name, ClangTidyContext *Context); Index: clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp +++ clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp @@ -25,7 +25,8 @@ RawStringHeaderFileExtensions(Options.getLocalOrGlobal( "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) { if (!utils::parseFileExtensions(RawStringHeaderFileExtensions, - HeaderFileExtensions, ',')) { + HeaderFileExtensions, + utils::defaultFileExtensionDelimiters())) { llvm::errs() << "Invalid header file extension: " << RawStringHeaderFileExtensions << "\n"; } Index: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h =================================================================== --- clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h +++ clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h @@ -19,11 +19,12 @@ /// Finds dynamically initialized static variables in header files. /// /// The check supports these options: -/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of -/// header files (The filename extensions should not contain "." prefix). -/// "h,hh,hpp,hxx" by default. +/// - `HeaderFileExtensions`: a semicolon-separated list of filename +/// extensions of header files (The filename extensions should not contain +/// "." prefix). ";h;hh;hpp;hxx" by default. +// /// For extension-less header files, using an empty string or leaving an -/// empty string between "," if there are other filename extensions. +/// empty string between ";" if there are other filename extensions. class DynamicStaticInitializersCheck : public ClangTidyCheck { public: DynamicStaticInitializersCheck(StringRef Name, ClangTidyContext *Context); Index: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp +++ clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp @@ -32,7 +32,8 @@ RawStringHeaderFileExtensions(Options.getLocalOrGlobal( "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) { if (!utils::parseFileExtensions(RawStringHeaderFileExtensions, - HeaderFileExtensions, ',')) { + HeaderFileExtensions, + utils::defaultFileExtensionDelimiters())) { llvm::errs() << "Invalid header file extension: " << RawStringHeaderFileExtensions << "\n"; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits