Skip to content

Commit e994900

Browse files
authored
Merge branch 'main' into loop-vectorize/stepvector
2 parents 6626037 + b0f2bfc commit e994900

File tree

181 files changed

+8160
-8027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+8160
-8027
lines changed

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def find_compilation_database(path: str) -> str:
8787

8888

8989
def get_tidy_invocation(
90-
f: str,
90+
f: Optional[str],
9191
clang_tidy_binary: str,
9292
checks: str,
9393
tmpdir: Optional[str],
@@ -147,7 +147,8 @@ def get_tidy_invocation(
147147
start.append(f"--warnings-as-errors={warnings_as_errors}")
148148
if allow_no_checks:
149149
start.append("--allow-no-checks")
150-
start.append(f)
150+
if f:
151+
start.append(f)
151152
return start
152153

153154

@@ -490,7 +491,7 @@ async def main() -> None:
490491

491492
try:
492493
invocation = get_tidy_invocation(
493-
"",
494+
None,
494495
clang_tidy_binary,
495496
args.checks,
496497
None,

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Improvements to clang-tidy
103103
- Fixed bug in :program:`clang-tidy` by which `HeaderFilterRegex` did not take
104104
effect when passed via the `.clang-tidy` file.
105105

106+
- Fixed bug in :program:`run_clang_tidy.py` where the program would not
107+
correctly display the checks enabled by the top-level `.clang-tidy` file.
108+
106109
New checks
107110
^^^^^^^^^^
108111

clang/docs/ReleaseNotes.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ C Language Changes
150150
- Added ``-Wimplicit-void-ptr-cast``, grouped under ``-Wc++-compat``, which
151151
diagnoses implicit conversion from ``void *`` to another pointer type as
152152
being incompatible with C++. (#GH17792)
153+
- Added ``-Wc++-hidden-decl``, grouped under ``-Wc++-compat``, which diagnoses
154+
use of tag types which are visible in C but not visible in C++ due to scoping
155+
rules. e.g.,
156+
157+
.. code-block:: c
158+
159+
struct S {
160+
struct T {
161+
int x;
162+
} t;
163+
};
164+
struct T t; // Invalid C++, valid C, now diagnosed
165+
- Added ``-Wimplicit-int-enum-cast``, grouped under ``-Wc++-compat``, which
166+
diagnoses implicit conversion from integer types to an enumeration type in C,
167+
which is not compatible with C++. #GH37027
168+
- Split "implicit conversion from enum type to different enum type" diagnostic
169+
from ``-Wenum-conversion`` into its own diagnostic group,
170+
``-Wimplicit-enum-enum-cast``, which is grouped under both
171+
``-Wenum-conversion`` and ``-Wimplicit-int-enum-cast``. This conversion is an
172+
int-to-enum conversion because the enumeration on the right-hand side is
173+
promoted to ``int`` before the assignment.
153174

154175
C2y Feature Support
155176
^^^^^^^^^^^^^^^^^^^
@@ -211,6 +232,8 @@ Non-comprehensive list of changes in this release
211232
- Added `__builtin_elementwise_exp10`.
212233
- For AMDPGU targets, added `__builtin_v_cvt_off_f32_i4` that maps to the `v_cvt_off_f32_i4` instruction.
213234
- Added `__builtin_elementwise_minnum` and `__builtin_elementwise_maxnum`.
235+
- No longer crashing on invalid Objective-C categories and extensions when
236+
dumping the AST as JSON. (#GH137320)
214237

215238
New Compiler Flags
216239
------------------
@@ -608,6 +631,8 @@ Arm and AArch64 Support
608631
- The ``+nosimd`` attribute is now fully supported for ARM. Previously, this had no effect when being used with
609632
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
610633
also now printed when the ``--print-supported-extensions`` option is used.
634+
- When a feature that depends on NEON (``simd``) is used, NEON is now automatically enabled.
635+
- When NEON is disabled (``+nosimd``), all features that depend on NEON will now be disabled.
611636

612637
- Support for __ptrauth type qualifier has been added.
613638

clang/include/clang/AST/DeclBase.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,10 +2239,14 @@ class DeclContext {
22392239
return DC && this->getPrimaryContext() == DC->getPrimaryContext();
22402240
}
22412241

2242-
/// Determine whether this declaration context encloses the
2242+
/// Determine whether this declaration context semantically encloses the
22432243
/// declaration context DC.
22442244
bool Encloses(const DeclContext *DC) const;
22452245

2246+
/// Determine whether this declaration context lexically encloses the
2247+
/// declaration context DC.
2248+
bool LexicallyEncloses(const DeclContext *DC) const;
2249+
22462250
/// Find the nearest non-closure ancestor of this context,
22472251
/// i.e. the innermost semantic parent of this context which is not
22482252
/// a closure. A context may be its own non-closure ancestor.

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ def err_modules_embed_file_not_found :
260260
DefaultFatal;
261261
def err_module_header_file_not_found :
262262
Error<"module header file '%0' not found">, DefaultFatal;
263+
def err_frontend_action_unsupported_input_format
264+
: Error<"%0 does not support input file format of file '%1': "
265+
"'%select{Source|ModuleMap|Precompiled|Unknown}2'">,
266+
DefaultFatal;
263267

264268
def err_test_module_file_extension_version : Error<
265269
"test module file extension '%0' has different version (%1.%2) than expected "

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ def AnonEnumEnumConversion : DiagGroup<"anon-enum-enum-conversion",
103103
[DeprecatedAnonEnumEnumConversion]>;
104104
def EnumEnumConversion : DiagGroup<"enum-enum-conversion",
105105
[DeprecatedEnumEnumConversion]>;
106+
def ImplicitEnumEnumCast : DiagGroup<"implicit-enum-enum-cast">;
106107
def EnumFloatConversion : DiagGroup<"enum-float-conversion",
107108
[DeprecatedEnumFloatConversion]>;
108109
def EnumConversion : DiagGroup<"enum-conversion",
109110
[EnumEnumConversion,
111+
ImplicitEnumEnumCast,
110112
EnumFloatConversion,
111113
EnumCompareConditional]>;
112114
def DeprecatedOFast : DiagGroup<"deprecated-ofast">;
@@ -154,10 +156,14 @@ def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
154156
def C99Compat : DiagGroup<"c99-compat">;
155157
def C23Compat : DiagGroup<"c23-compat">;
156158
def : DiagGroup<"c2x-compat", [C23Compat]>;
159+
def HiddenCppDecl : DiagGroup<"c++-hidden-decl">;
157160
def DefaultConstInitUnsafe : DiagGroup<"default-const-init-unsafe">;
158161
def DefaultConstInit : DiagGroup<"default-const-init", [DefaultConstInitUnsafe]>;
159162
def ImplicitVoidPtrCast : DiagGroup<"implicit-void-ptr-cast">;
160-
def CXXCompat: DiagGroup<"c++-compat", [ImplicitVoidPtrCast, DefaultConstInit]>;
163+
def ImplicitIntToEnumCast : DiagGroup<"implicit-int-enum-cast",
164+
[ImplicitEnumEnumCast]>;
165+
def CXXCompat: DiagGroup<"c++-compat", [ImplicitVoidPtrCast, DefaultConstInit,
166+
ImplicitIntToEnumCast, HiddenCppDecl]>;
161167

162168
def ExternCCompat : DiagGroup<"extern-c-compat">;
163169
def KeywordCompat : DiagGroup<"keyword-compat">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,10 @@ def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
496496
"%select{used|required to be captured for this use}1">,
497497
InGroup<UnusedLambdaCapture>, DefaultIgnore;
498498

499+
def warn_decl_hidden_in_cpp : Warning<
500+
"%select{struct|union|enum}0 defined within a struct or union is not visible "
501+
"in C++">, InGroup<HiddenCppDecl>, DefaultIgnore;
502+
499503
def warn_reserved_extern_symbol: Warning<
500504
"identifier %0 is reserved because %select{"
501505
"<ERROR>|" // ReservedIdentifierStatus::NotReserved
@@ -4310,7 +4314,10 @@ def warn_impcast_string_literal_to_bool : Warning<
43104314
InGroup<StringConversion>, DefaultIgnore;
43114315
def warn_impcast_different_enum_types : Warning<
43124316
"implicit conversion from enumeration type %0 to different enumeration type "
4313-
"%1">, InGroup<EnumConversion>;
4317+
"%1">, InGroup<ImplicitEnumEnumCast>;
4318+
def warn_impcast_int_to_enum : Warning<
4319+
"implicit conversion from %0 to enumeration type %1 is invalid in C++">,
4320+
InGroup<ImplicitIntToEnumCast>, DefaultIgnore;
43144321
def warn_impcast_bool_to_null_pointer : Warning<
43154322
"initialization of pointer of type %0 to null from a constant boolean "
43164323
"expression">, InGroup<BoolConversion>;

clang/include/clang/Basic/HeaderInclude.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ enum HeaderIncludeFormatKind { HIFMT_None, HIFMT_Textual, HIFMT_JSON };
2323

2424
/// Whether header information is filtered or not. If HIFIL_Only_Direct_System
2525
/// is used, only information on system headers directly included from
26-
/// non-system headers is emitted.
27-
enum HeaderIncludeFilteringKind { HIFIL_None, HIFIL_Only_Direct_System };
26+
/// non-system files is emitted. The HIFIL_Direct_Per_File filtering shows the
27+
/// direct imports and includes for each non-system source and header file
28+
/// separately.
29+
enum HeaderIncludeFilteringKind {
30+
HIFIL_None,
31+
HIFIL_Only_Direct_System,
32+
HIFIL_Direct_Per_File
33+
};
2834

2935
inline HeaderIncludeFormatKind
3036
stringToHeaderIncludeFormatKind(const char *Str) {
@@ -40,6 +46,7 @@ inline bool stringToHeaderIncludeFiltering(const char *Str,
4046
llvm::StringSwitch<std::pair<bool, HeaderIncludeFilteringKind>>(Str)
4147
.Case("none", {true, HIFIL_None})
4248
.Case("only-direct-system", {true, HIFIL_Only_Direct_System})
49+
.Case("direct-per-file", {true, HIFIL_Direct_Per_File})
4350
.Default({false, HIFIL_None});
4451
Kind = P.second;
4552
return P.first;
@@ -64,6 +71,8 @@ headerIncludeFilteringKindToString(HeaderIncludeFilteringKind K) {
6471
return "none";
6572
case HIFIL_Only_Direct_System:
6673
return "only-direct-system";
74+
case HIFIL_Direct_Per_File:
75+
return "direct-per-file";
6776
}
6877
llvm_unreachable("Unknown HeaderIncludeFilteringKind enum");
6978
}

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7793,7 +7793,8 @@ def header_include_format_EQ : Joined<["-"], "header-include-format=">,
77937793
MarshallingInfoEnum<DependencyOutputOpts<"HeaderIncludeFormat">, "HIFMT_Textual">;
77947794
def header_include_filtering_EQ : Joined<["-"], "header-include-filtering=">,
77957795
HelpText<"set the flag that enables filtering header information">,
7796-
Values<"none,only-direct-system">, NormalizedValues<["HIFIL_None", "HIFIL_Only_Direct_System"]>,
7796+
Values<"none,only-direct-system,direct-per-file">,
7797+
NormalizedValues<["HIFIL_None", "HIFIL_Only_Direct_System", "HIFIL_Direct_Per_File"]>,
77977798
MarshallingInfoEnum<DependencyOutputOpts<"HeaderIncludeFiltering">, "HIFIL_None">;
77987799
def show_includes : Flag<["--"], "show-includes">,
77997800
HelpText<"Print cl.exe style /showIncludes to stdout">;

clang/include/clang/Frontend/FrontendActions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
156156
/// files) for C++20 Named Modules.
157157
class GenerateModuleInterfaceAction : public GenerateModuleAction {
158158
protected:
159+
bool PrepareToExecuteAction(CompilerInstance &CI) override;
159160
bool BeginSourceFileAction(CompilerInstance &CI) override;
160161

161162
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,

0 commit comments

Comments
 (0)