Skip to content

Commit 92995f5

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents d563f64 + 65ffa53 commit 92995f5

File tree

24 files changed

+443
-181
lines changed

24 files changed

+443
-181
lines changed

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ ClangTidyASTConsumerFactory::createASTConsumer(
424424
FinderOptions.CheckProfiling.emplace(Profiling->Records);
425425
}
426426

427+
// Avoid processing system headers, unless the user explicitly requests it
428+
if (!Context.getOptions().SystemHeaders.value_or(false))
429+
FinderOptions.IgnoreSystemHeaders = true;
430+
427431
std::unique_ptr<ast_matchers::MatchFinder> Finder(
428432
new ast_matchers::MatchFinder(std::move(FinderOptions)));
429433

clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ void PreferMemberInitializerCheck::check(
191191
if (!AssignmentToMember)
192192
continue;
193193
const FieldDecl *Field = AssignmentToMember->Field;
194+
// Skip if the field is inherited from a base class.
195+
if (Field->getParent() != Class)
196+
continue;
194197
const Expr *InitValue = AssignmentToMember->Init;
195198
updateAssignmentLevel(Field, InitValue, Ctor, AssignedFields);
196199
if (!canAdvanceAssignment(AssignedFields[Field]))

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import json
2929
import multiprocessing
3030
import os
31+
import queue
3132
import re
3233
import shutil
3334
import subprocess
@@ -42,13 +43,6 @@
4243
except ImportError:
4344
yaml = None
4445

45-
is_py2 = sys.version[0] == "2"
46-
47-
if is_py2:
48-
import Queue as queue
49-
else:
50-
import queue as queue
51-
5246

5347
def run_tidy(task_queue, lock, timeout, failed_files):
5448
watchdog = None

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ Improvements to clang-query
104104
Improvements to clang-tidy
105105
--------------------------
106106

107+
- :program:`clang-tidy` no longer attemps to analyze code from system headers
108+
by default, greatly improving performance. This behavior is disabled if the
109+
`SystemHeaders` option is enabled.
110+
107111
- The :program:`run-clang-tidy.py` and :program:`clang-tidy-diff.py` scripts
108112
now run checks in parallel by default using all available hardware threads.
109113
Both scripts display the number of threads being used in their output.
@@ -163,6 +167,10 @@ Changes in existing checks
163167
an additional matcher that generalizes the copy-and-swap idiom pattern
164168
detection.
165169

170+
- Improved :doc:`cppcoreguidelines-prefer-member-initializer
171+
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to
172+
avoid false positives on inherited members in class templates.
173+
166174
- Improved :doc:`misc-header-include-cycle
167175
<clang-tidy/checks/misc/header-include-cycle>` check performance.
168176

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,3 +650,16 @@ struct InitFromBindingDecl {
650650
}
651651
};
652652
} // namespace GH82970
653+
654+
struct A {
655+
int m;
656+
};
657+
658+
struct B : A {
659+
B() { m = 0; }
660+
};
661+
662+
template <class T>
663+
struct C : A {
664+
C() { m = 0; }
665+
};

clang-tools-extra/test/clang-tidy/infrastructure/file-filter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,14 @@ class A { A(int); };
6666
// CHECK4-NOT: warning:
6767
// CHECK4-QUIET-NOT: warning:
6868

69-
// CHECK: Suppressed 3 warnings (3 in non-user code)
7069
// CHECK: Use -header-filter=.* to display errors from all non-system headers.
7170
// CHECK-QUIET-NOT: Suppressed
72-
// CHECK2: Suppressed 1 warnings (1 in non-user code)
73-
// CHECK2: Use -header-filter=.* {{.*}}
7471
// CHECK2-QUIET-NOT: Suppressed
75-
// CHECK3: Suppressed 2 warnings (2 in non-user code)
7672
// CHECK3: Use -header-filter=.* {{.*}}
7773
// CHECK3-QUIET-NOT: Suppressed
7874
// CHECK4-NOT: Suppressed {{.*}} warnings
7975
// CHECK4-NOT: Use -header-filter=.* {{.*}}
8076
// CHECK4-QUIET-NOT: Suppressed
81-
// CHECK6: Suppressed 2 warnings (2 in non-user code)
8277
// CHECK6: Use -header-filter=.* {{.*}}
8378

8479
int x = 123;

clang-tools-extra/test/clang-tidy/infrastructure/system-headers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// RUN: clang-tidy -help | FileCheck -check-prefix=CHECK-OPT-PRESENT %s
1212

1313
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers=true %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-SYSTEM-HEADERS %s
14-
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers=false %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-NO-SYSTEM-HEADERS %s
14+
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers=false %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-NO-SYSTEM-HEADERS --allow-empty %s
1515
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -config='SystemHeaders: true' %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-SYSTEM-HEADERS %s
16-
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -config='SystemHeaders: false' %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-NO-SYSTEM-HEADERS %s
16+
// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -config='SystemHeaders: false' %s -- -isystem %S/Inputs/system-headers 2>&1 | FileCheck -check-prefix=CHECK-NO-SYSTEM-HEADERS --allow-empty %s
1717

1818
#include <system_header.h>
1919
// CHECK-SYSTEM-HEADERS: system_header.h:1:13: warning: single-argument constructors must be marked explicit

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ clang-format is turned off or back on.
126126
// clang-format on
127127
void formatted_code_again;
128128

129+
In addition, the ``OneLineFormatOffRegex`` option gives you a concise way to
130+
disable formatting for all of the lines that match the regular expression.
131+
129132

130133
Configuring Style in Code
131134
=========================

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ Bug Fixes to AST Handling
476476
- Fix incorrect name qualifiers applied to alias CTAD. (#GH136624)
477477
- Fixed ElaboratedTypes appearing within NestedNameSpecifier, which was not a
478478
legal representation. This is fixed because ElaboratedTypes don't exist anymore. (#GH43179) (#GH68670) (#GH92757)
479+
- Fix unrecognized html tag causing undesirable comment lexing (#GH152944)
479480
- Fix comment lexing of special command names (#GH152943)
480481

481482
Miscellaneous Bug Fixes
@@ -560,6 +561,9 @@ AST Matchers
560561
- Ensure ``hasBitWidth`` doesn't crash on bit widths that are dependent on template
561562
parameters.
562563

564+
- Add a boolean member ``IgnoreSystemHeaders`` to ``MatchFinderOptions``. This
565+
allows it to ignore nodes in system headers when traversing the AST.
566+
563567
clang-format
564568
------------
565569

clang/include/clang/AST/CommentHTMLTags.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ def Col : Tag<"col"> { let EndTagForbidden = 1; }
5151
def Tr : Tag<"tr"> { let EndTagOptional = 1; }
5252
def Th : Tag<"th"> { let EndTagOptional = 1; }
5353
def Td : Tag<"td"> { let EndTagOptional = 1; }
54+
def Summary : Tag<"summary">;
55+
def Details : Tag<"details">;
56+
def Mark : Tag<"mark">;
57+
def Figure : Tag<"figure">;
58+
def FigCaption : Tag<"figcaption">;
5459

5560
// Define a list of attributes that are not safe to pass through to HTML
5661
// output if the input is untrusted.

0 commit comments

Comments
 (0)