diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 327fe02735468..cbb3babe9d472 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -235,7 +235,7 @@ static constexpr StringRef DeclStmtName = "decl-stmt"; UseUsingCheck::UseUsingCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), IgnoreMacros(Options.get("IgnoreMacros", true)), - IgnoreExternC(Options.get("IgnoreExternC", false)) {} + IgnoreExternC(Options.get("IgnoreExternC", true)) {} void UseUsingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { Options.store(Opts, "IgnoreMacros", IgnoreMacros); diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index e60800fd913d1..b3a2e89ac90c6 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -49,6 +49,10 @@ Major New Features Potentially Breaking Changes ---------------------------- +- The :doc:`modernize-use-using ` check + now sets the `IgnoreExternC` option to `true` by default. The check will + no longer transform ``typedef``\ s within ``extern "C"`` blocks. + - Deprecated the :program:`clang-tidy` check :doc:`performance-faster-string-find `. It has been renamed to :doc:`performance-prefer-single-char-overloads @@ -580,6 +584,8 @@ Changes in existing checks - Preserve inline comment blocks that appear between the ``typedef``'s parts. + - The `IgnoreExternC` option is now set to `true` by default. + - Improved :doc:`performance-enum-size ` check: diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst index 9eedf20cb9723..82704fbbfedb0 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst @@ -49,4 +49,4 @@ Options .. option:: IgnoreExternC If set to `true`, the check will not give warning inside ``extern "C"`` - scope. Default is `false` + scope. Default is `true`. diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using-ignore-extern-c.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using-ignore-extern-c.cpp index 6a845a0bcc350..ac7c767c610e3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using-ignore-extern-c.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using-ignore-extern-c.cpp @@ -1,9 +1,11 @@ -// RUN: %check_clang_tidy %s modernize-use-using %t -- -config="{CheckOptions: {modernize-use-using.IgnoreExternC: true}}" -- -I %S/Input/use-using/ +// RUN: %check_clang_tidy %s modernize-use-using %t -- -config="{CheckOptions: {modernize-use-using.IgnoreExternC: false}}" -- -I %S/Input/use-using/ // Some Header extern "C" { typedef int NewInt; +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using NewInt = int; } extern "C++" { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp index 232dd33f35f37..36dc93faca461 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp @@ -330,8 +330,6 @@ typedef class ISSUE_67529_1 *ISSUE_67529; extern "C" { typedef int InExternC; -// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] -// CHECK-FIXES: using InExternC = int; }