llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Aegislin (voyager-jhk) <details> <summary>Changes</summary> This prevents generating invalid C code in mixed-language headers by leaving `typedef` declarations inside `extern "C"` blocks intact by default. Fixes #<!-- -->141394 Cc @<!-- -->zeyi2 @<!-- -->vbvictor --- Full diff: https://github.com/llvm/llvm-project/pull/199189.diff 4 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp (+1-1) - (modified) clang-tools-extra/docs/ReleaseNotes.rst (+2) - (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst (+1-1) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp (-2) ``````````diff 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..62e165e818ede 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -580,6 +580,8 @@ Changes in existing checks - Preserve inline comment blocks that appear between the ``typedef``'s parts. + - The ``IgnoreExternC`` option is now enabled by default. + - Improved :doc:`performance-enum-size <clang-tidy/checks/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.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; } `````````` </details> https://github.com/llvm/llvm-project/pull/199189 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
