[clang-tools-extra] c7575fc - Revert "[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options"

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 21:21:18 PST 2023


Author: Carlos Galvez
Date: 2023-01-25T05:17:00Z
New Revision: c7575fcb685a15f5384c137c76913e0bb11d1320

URL: https://github.com/llvm/llvm-project/commit/c7575fcb685a15f5384c137c76913e0bb11d1320
DIFF: https://github.com/llvm/llvm-project/commit/c7575fcb685a15f5384c137c76913e0bb11d1320.diff

LOG: Revert "[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options"

This reverts commit 4240c9146248ac0a91c45dee421c6ef07709ba74.

The current solution won't work since getLocalOrGlobal does not
support returning a vector. More work needs to be put into
ensuring both the local and global way of setting the options
are available during the transition period.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
    clang-tools-extra/clang-tidy/ClangTidyOptions.h
    clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
    clang-tools-extra/docs/ReleaseNotes.rst
    clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst
    clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst
    clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst
    clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst
    clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst
    clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst
    clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst
    clang-tools-extra/docs/clang-tidy/index.rst
    clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp
    clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
index 84defccde513e..808929b11f796 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -122,9 +122,6 @@ template <> struct MappingTraits<ClangTidyOptions> {
     bool Ignored = false;
     IO.mapOptional("Checks", Options.Checks);
     IO.mapOptional("WarningsAsErrors", Options.WarningsAsErrors);
-    IO.mapOptional("HeaderFileExtensions", Options.HeaderFileExtensions);
-    IO.mapOptional("ImplementationFileExtensions",
-                   Options.ImplementationFileExtensions);
     IO.mapOptional("HeaderFilterRegex", Options.HeaderFilterRegex);
     IO.mapOptional("AnalyzeTemporaryDtors", Ignored); // deprecated
     IO.mapOptional("FormatStyle", Options.FormatStyle);
@@ -145,8 +142,6 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
   ClangTidyOptions Options;
   Options.Checks = "";
   Options.WarningsAsErrors = "";
-  Options.HeaderFileExtensions = {"", "h", "hh", "hpp", "hxx"};
-  Options.ImplementationFileExtensions = {"c", "cc", "cpp", "cxx"};
   Options.HeaderFilterRegex = "";
   Options.SystemHeaders = false;
   Options.FormatStyle = "none";
@@ -183,9 +178,6 @@ ClangTidyOptions &ClangTidyOptions::mergeWith(const ClangTidyOptions &Other,
                                               unsigned Order) {
   mergeCommaSeparatedLists(Checks, Other.Checks);
   mergeCommaSeparatedLists(WarningsAsErrors, Other.WarningsAsErrors);
-  overrideValue(HeaderFileExtensions, Other.HeaderFileExtensions);
-  overrideValue(ImplementationFileExtensions,
-                Other.ImplementationFileExtensions);
   overrideValue(HeaderFilterRegex, Other.HeaderFilterRegex);
   overrideValue(SystemHeaders, Other.SystemHeaders);
   overrideValue(FormatStyle, Other.FormatStyle);

diff  --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.h b/clang-tools-extra/clang-tidy/ClangTidyOptions.h
index d0df474bc38e0..4a6cdf097905b 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyOptions.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.h
@@ -71,14 +71,6 @@ struct ClangTidyOptions {
   /// WarningsAsErrors filter.
   std::optional<std::string> WarningsAsErrors;
 
-  /// File extensions to consider to determine if a given diagnostic is located
-  /// in a header file.
-  std::optional<std::vector<std::string>> HeaderFileExtensions;
-
-  /// File extensions to consider to determine if a given diagnostic is located
-  /// is located in an implementation file.
-  std::optional<std::vector<std::string>> ImplementationFileExtensions;
-
   /// Output warnings from headers matching this filter. Warnings from
   /// main files will always be displayed.
   std::optional<std::string> HeaderFilterRegex;

diff  --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index e8728c046e334..765b8483561ea 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -46,14 +46,12 @@ Configuration files:
 
     $ clang-tidy -dump-config
     ---
-    Checks:                       '-*,some-check'
-    WarningsAsErrors:             ''
-    HeaderFileExtensions:         ['', 'h','hh','hpp','hxx']
-    ImplementationFileExtensions: ['c','cc','cpp','cxx']
-    HeaderFilterRegex:            ''
-    FormatStyle:                  none
-    InheritParentConfig:          true
-    User:                         user
+    Checks:              '-*,some-check'
+    WarningsAsErrors:    ''
+    HeaderFilterRegex:   ''
+    FormatStyle:         none
+    InheritParentConfig: true
+    User:                user
     CheckOptions:
       some-check.SomeOption: 'some value'
     ...
@@ -132,10 +130,10 @@ well.
                                cl::init(false), cl::cat(ClangTidyCategory));
 
 static cl::opt<bool> FixNotes("fix-notes", cl::desc(R"(
-If a warning has no fix, but a single fix can
-be found through an associated diagnostic note,
-apply the fix.
-Specifying this flag will implicitly enable the
+If a warning has no fix, but a single fix can 
+be found through an associated diagnostic note, 
+apply the fix. 
+Specifying this flag will implicitly enable the 
 '--fix' flag.
 )"),
                               cl::init(false), cl::cat(ClangTidyCategory));
@@ -460,26 +458,6 @@ static bool verifyChecks(const StringSet<> &AllChecks, StringRef CheckGlob,
   return AnyInvalid;
 }
 
-static bool verifyFileExtensions(
-    const std::vector<std::string> &HeaderFileExtensions,
-    const std::vector<std::string> &ImplementationFileExtensions,
-    StringRef Source) {
-  bool AnyInvalid = false;
-  for (const auto &HeaderExtension : HeaderFileExtensions) {
-    for (const auto &ImplementationExtension : ImplementationFileExtensions) {
-      if (HeaderExtension == ImplementationExtension) {
-        AnyInvalid = true;
-        auto &Output = llvm::WithColor::warning(llvm::errs(), Source)
-                       << "HeaderFileExtension '" << HeaderExtension << '\''
-                       << " is the same as ImplementationFileExtension '"
-                       << ImplementationExtension << '\'';
-        Output << VerifyConfigWarningEnd;
-      }
-    }
-  }
-  return AnyInvalid;
-}
-
 int clangTidyMain(int argc, const char **argv) {
   llvm::InitLLVM X(argc, argv);
 
@@ -583,11 +561,6 @@ int clangTidyMain(int argc, const char **argv) {
       if (Opts.Checks)
         AnyInvalid |= verifyChecks(Valid.Names, *Opts.Checks, Source);
 
-      if (Opts.HeaderFileExtensions && Opts.ImplementationFileExtensions)
-        AnyInvalid |=
-            verifyFileExtensions(*Opts.HeaderFileExtensions,
-                                 *Opts.ImplementationFileExtensions, Source);
-
       for (auto Key : Opts.CheckOptions.keys()) {
         if (Valid.Options.contains(Key))
           continue;

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index c83306f67b415..434dcd955679d 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -106,10 +106,6 @@ Improvements to clang-tidy
   which is no longer in use. The option will be fully removed in
   :program:`clang-tidy` version 18.
 
-- New global configuration file options `HeaderFileExtensions` and
-  `ImplementationFileExtensions`, replacing the check-local options of the
-  same name.
-
 New checks
 ^^^^^^^^^^
 
@@ -161,61 +157,26 @@ Changes in existing checks
   <clang-tidy/checks/bugprone/assignment-in-if-condition>` check when there
   was an assignement in a lambda found in the condition of an ``if``.
 
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`bugprone-dynamic-static-initializers
-  <clang-tidy/checks/bugprone/dynamic-static-initializers>` check.
-  Global options of the same name should be used instead.
-
 - Improved :doc:`bugprone-signal-handler
   <clang-tidy/checks/bugprone/signal-handler>` check. Partial
   support for C++14 signal handler rules was added. Bug report generation was
   improved.
 
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`bugprone-suspicious-include
-  <clang-tidy/checks/bugprone/suspicious-include>` check.
-  Global options of the same name should be used instead.
-
 - Fixed a false positive in :doc:`cppcoreguidelines-pro-type-member-init
   <clang-tidy/checks/cppcoreguidelines/pro-type-member-init>` when warnings
   would be emitted for uninitialized members of an anonymous union despite
   there being an initializer for one of the other members.
 
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`google-build-namespaces
-  <clang-tidy/checks/google/build-namespaces>` check.
-  Global options of the same name should be used instead.
-
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`google-global-names-in-headers
-  <clang-tidy/checks/google/global-names-in-headers>` check.
-  Global options of the same name should be used instead.
-
 - Fixed false positives in :doc:`google-objc-avoid-throwing-exception
   <clang-tidy/checks/google/objc-avoid-throwing-exception>` check for exceptions
   thrown by code emitted from macros in system headers.
 
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`llvm-header-guard
-  <clang-tidy/checks/llvm/header-guard>` check.
-  Global options of the same name should be used instead.
-
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`misc-definitions-in-headers
-  <clang-tidy/checks/misc/definitions-in-headers>` check.
-  Global options of the same name should be used instead.
-
 - Improved :doc:`misc-redundant-expression <clang-tidy/checks/misc/redundant-expression>`
   check.
 
   The check now skips concept definitions since redundant expressions still make sense
   inside them.
 
-- Deprecated check-local options `HeaderFileExtensions` and `ImplementationFileExtensions`
-  in :doc:`misc-unused-using-decls
-  <clang-tidy/checks/misc/unused-using-decls>` check.
-  Global options of the same name should be used instead.
-
 - Improved :doc:`modernize-loop-convert <clang-tidy/checks/modernize/loop-convert>`
   to check for container functions ``begin``/``end`` etc on base classes of the container
   type, instead of only as direct members of the container type itself.

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst
index f1956987a9f50..3c05f39db12d5 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-include.rst
@@ -19,10 +19,6 @@ Options
 -------
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    Default value: ``";h;hh;hpp;hxx"``
    A semicolon-separated list of filename extensions of header files (the
    filename extensions should not contain a "." prefix). For extension-less
@@ -31,10 +27,6 @@ Options
 
 .. option:: ImplementationFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`.
-   version 18. Please use the global configuration option
-   `ImplementationFileExtensions`.
-
    Default value: ``"c;cc;cpp;cxx"``
    Likewise, a semicolon-separated list of filename extensions of
    implementation files.

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst b/clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst
index bd8d704e2a734..ca40f99eef6fc 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/google/build-namespaces.rst
@@ -17,10 +17,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A comma-separated list of filename extensions of header files (the filename
    extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
    For header files without an extension, use an empty string (if there are no

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst b/clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst
index ea160ec3a7dff..32740eade0039 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/google/global-names-in-headers.rst
@@ -14,10 +14,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A comma-separated list of filename extensions of header files (the filename
    extensions should not contain "." prefix). Default is "h".
    For header files without an extension, use an empty string (if there are no

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst b/clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst
index 28b29dbd39bff..b27002ad606a8 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/llvm/header-guard.rst
@@ -10,10 +10,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A comma-separated list of filename extensions of header files (the filename
    extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
    For header files without an extension, use an empty string (if there are no

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst
index 55d65e2b6340e..a1fa09a25ca0c 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/definitions-in-headers.rst
@@ -92,10 +92,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A comma-separated list of filename extensions of header files (the filename
    extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
    For header files without an extension, use an empty string (if there are no
@@ -104,9 +100,5 @@ Options
 
 .. option:: UseHeaderFileExtension
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. The check will unconditionally use the global option
-   `HeaderFileExtensions`.
-
    When `true`, the check will use the file extension to distinguish header
    files. Default is `true`.

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst
index 8246a9cfe08eb..26dcf40c01b46 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-using-decls.rst
@@ -22,10 +22,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A semicolon-separated list of filename extensions of header files (the filename
    extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
    For extension-less header files, use an empty string or leave an

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst
index 3cf059febb825..6b256707366cb 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/use-anonymous-namespace.rst
@@ -38,10 +38,6 @@ Options
 
 .. option:: HeaderFileExtensions
 
-   Note: this option is deprecated, it will be removed in :program:`clang-tidy`
-   version 18. Please use the global configuration option
-   `HeaderFileExtensions`.
-
    A semicolon-separated list of filename extensions of header files (the filename
    extensions should not include "." prefix). Default is ";h;hh;hpp;hxx".
    For extension-less header files, using an empty string or leaving an

diff  --git a/clang-tools-extra/docs/clang-tidy/index.rst b/clang-tools-extra/docs/clang-tidy/index.rst
index 67106230e5ff3..e2a9f95d0e115 100644
--- a/clang-tools-extra/docs/clang-tidy/index.rst
+++ b/clang-tools-extra/docs/clang-tidy/index.rst
@@ -139,7 +139,7 @@ An overview of all the command-line options:
                                      When the value is empty, clang-tidy will
                                      attempt to find a file named .clang-tidy for
                                      each source file in its parent directories.
-    --config-file=<string>         -
+    --config-file=<string>         - 
                                     Specify the path of .clang-tidy or custom config file:
                                       e.g. --config-file=/some/path/myTidyConfigFile
                                     This option internally works exactly the same way as
@@ -237,7 +237,7 @@ An overview of all the command-line options:
                                      format to stderr. When this option is passed,
                                      these per-TU profiles are instead stored as JSON.
     --system-headers               - Display the errors from system headers.
-    --use-color                    -
+    --use-color                    - 
                                     Use colors in diagnostics. If not set, colors
                                     will be used if the terminal connected to
                                     standard output supports colors.
@@ -287,14 +287,12 @@ An overview of all the command-line options:
 
       $ clang-tidy -dump-config
       ---
-      Checks:                       '-*,some-check'
-      WarningsAsErrors:             ''
-      HeaderFileExtensions:         ['', 'h','hh','hpp','hxx']
-      ImplementationFileExtensions: ['c','cc','cpp','cxx']
-      HeaderFilterRegex:            ''
-      FormatStyle:                  none
-      InheritParentConfig:          true
-      User:                         user
+      Checks:              '-*,some-check'
+      WarningsAsErrors:    ''
+      HeaderFilterRegex:   ''
+      FormatStyle:         none
+      InheritParentConfig: true
+      User:                user
       CheckOptions:
         some-check.SomeOption: 'some value'
       ...

diff  --git a/clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp
index e127c23cc328a..edd6a9ee362df 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp
@@ -3,8 +3,6 @@
 
 // RUN: not clang-tidy -verify-config \
 // RUN: --checks='-*,bad*glob,llvm*,llvm-includeorder,my-made-up-check' --config='{Checks: "readability-else-after-ret", \
-// RUN: HeaderFileExtensions: ["h", "hh", "hpp"], \
-// RUN: ImplementationFileExtensions: ["c", "cc", "hpp"], \
 // RUN: CheckOptions: [{key: "IgnoreMacros", value: "true"}, \
 // RUN:                {key: "StriceMode", value: "true"}, \
 // RUN:                {key: modernize-lop-convert.UseCxx20ReverseRanges, value: true} \
@@ -14,7 +12,6 @@
 // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check 'readability-else-after-ret'; did you mean 'readability-else-after-return' [-verify-config]
 // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check option 'modernize-lop-convert.UseCxx20ReverseRanges'; did you mean 'modernize-loop-convert.UseCxx20ReverseRanges' [-verify-config]
 // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check option 'StriceMode'; did you mean 'StrictMode' [-verify-config]
-// CHECK-VERIFY-DAG: command-line option '-config': warning: HeaderFileExtension 'hpp' is the same as ImplementationFileExtension 'hpp' [-verify-config]
 // CHECK-VERIFY: command-line option '-checks': warning: check glob 'bad*glob' doesn't match any known check [-verify-config]
 // CHECK-VERIFY: command-line option '-checks': warning: unknown check 'llvm-includeorder'; did you mean 'llvm-include-order' [-verify-config]
 // CHECK-VERIFY: command-line option '-checks': warning: unknown check 'my-made-up-check' [-verify-config]

diff  --git a/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp b/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
index 06f27d86dea22..4b8810237c28c 100644
--- a/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -76,20 +76,13 @@ TEST(ParseLineFilter, ValidFilter) {
 
 TEST(ParseConfiguration, ValidConfiguration) {
   llvm::ErrorOr<ClangTidyOptions> Options =
-      parseConfiguration(llvm::MemoryBufferRef(
-          "Checks: \"-*,misc-*\"\n"
-          "HeaderFileExtensions: [\"\",\"h\",\"hh\",\"hpp\",\"hxx\"]\n"
-          "ImplementationFileExtensions: [\"c\",\"cc\",\"cpp\",\"cxx\"]\n"
-          "HeaderFilterRegex: \".*\"\n"
-          "AnalyzeTemporaryDtors: true\n"
-          "User: some.user",
-          "Options"));
+      parseConfiguration(llvm::MemoryBufferRef("Checks: \"-*,misc-*\"\n"
+                                               "HeaderFilterRegex: \".*\"\n"
+                                               "AnalyzeTemporaryDtors: true\n"
+                                               "User: some.user",
+                                               "Options"));
   EXPECT_TRUE(!!Options);
   EXPECT_EQ("-*,misc-*", *Options->Checks);
-  EXPECT_EQ(std::vector<std::string>({"", "h", "hh", "hpp", "hxx"}),
-            *Options->HeaderFileExtensions);
-  EXPECT_EQ(std::vector<std::string>({"c", "cc", "cpp", "cxx"}),
-            *Options->ImplementationFileExtensions);
   EXPECT_EQ(".*", *Options->HeaderFilterRegex);
   EXPECT_EQ("some.user", *Options->User);
 }
@@ -112,8 +105,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
   llvm::ErrorOr<ClangTidyOptions> Options1 =
       parseConfiguration(llvm::MemoryBufferRef(R"(
       Checks: "check1,check2"
-      HeaderFileExtensions: ["h","hh"]
-      ImplementationFileExtensions: ["c","cc"]
       HeaderFilterRegex: "filter1"
       AnalyzeTemporaryDtors: true
       User: user1
@@ -126,8 +117,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
   llvm::ErrorOr<ClangTidyOptions> Options2 =
       parseConfiguration(llvm::MemoryBufferRef(R"(
       Checks: "check3,check4"
-      HeaderFileExtensions: ["hpp","hxx"]
-      ImplementationFileExtensions: ["cpp","cxx"]
       HeaderFilterRegex: "filter2"
       AnalyzeTemporaryDtors: false
       User: user2
@@ -139,10 +128,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
   ASSERT_TRUE(!!Options2);
   ClangTidyOptions Options = Options1->merge(*Options2, 0);
   EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
-  EXPECT_EQ(std::vector<std::string>({"hpp", "hxx"}),
-            *Options.HeaderFileExtensions);
-  EXPECT_EQ(std::vector<std::string>({"cpp", "cxx"}),
-            *Options.ImplementationFileExtensions);
   EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
   EXPECT_EQ("user2", *Options.User);
   ASSERT_TRUE(Options.ExtraArgs.has_value());


        


More information about the cfe-commits mailing list