70 changes: 0 additions & 70 deletions clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.cpp

This file was deleted.

55 changes: 0 additions & 55 deletions clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.h

This file was deleted.

4 changes: 2 additions & 2 deletions clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ void HeaderGuardCheck::registerPPCallbacks(const SourceManager &SM,
}

bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
return utils::isFileExtension(FileName, HeaderFileExtensions);
}

bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }

bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
return utils::isFileExtension(FileName, HeaderFileExtensions);
}

std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Expand Down
18 changes: 10 additions & 8 deletions clang-tools-extra/clang-tidy/utils/HeaderGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,29 @@
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H

#include "../ClangTidy.h"
#include "../utils/HeaderFileExtensionsUtils.h"
#include "../utils/FileExtensionsUtils.h"

namespace clang {
namespace tidy {
namespace utils {

/// 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)
: ClangTidyCheck(Name, Context),
RawStringHeaderFileExtensions(Options.getLocalOrGlobal(
"HeaderFileExtensions", utils::defaultHeaderFileExtensions())) {
utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
HeaderFileExtensions, ',');
utils::parseFileExtensions(RawStringHeaderFileExtensions,
HeaderFileExtensions,
utils::defaultFileExtensionDelimiters());
}
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
Preprocessor *ModuleExpanderPP) override;
Expand All @@ -54,7 +56,7 @@ class HeaderGuardCheck : public ClangTidyCheck {

private:
std::string RawStringHeaderFileExtensions;
utils::HeaderFileExtensionsSet HeaderFileExtensions;
utils::FileExtensionsSet HeaderFileExtensions;
};

} // namespace utils
Expand Down
5 changes: 5 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ Changes in existing checks
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
^^^^^^^^^^^^^^

Expand Down