Skip to content

Commit a168ec7

Browse files
committed
merge main into amd-staging
2 parents e2cc94e + 0e40051 commit a168ec7

File tree

85 files changed

+2621
-306
lines changed

Some content is hidden

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

85 files changed

+2621
-306
lines changed

clang-tools-extra/clang-include-fixer/IncludeFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Action : public clang::ASTFrontendAction {
5353

5454
Compiler->createSema(getTranslationUnitKind(), CompletionConsumer);
5555
SemaSource->setCompilerInstance(Compiler);
56-
Compiler->getSema().addExternalSource(SemaSource.get());
56+
Compiler->getSema().addExternalSource(SemaSource);
5757

5858
clang::ParseAST(Compiler->getSema(), Compiler->getFrontendOpts().ShowStats,
5959
Compiler->getFrontendOpts().SkipFunctionBodies);

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ RenamerClangTidyCheck::addUsage(
432432
if (FixLocation.isInvalid())
433433
return {NamingCheckFailures.end(), false};
434434

435+
// Skip if in system system header
436+
if (SourceMgr.isInSystemHeader(FixLocation))
437+
return {NamingCheckFailures.end(), false};
438+
435439
auto EmplaceResult = NamingCheckFailures.try_emplace(FailureId);
436440
NamingCheckFailure &Failure = EmplaceResult.first->second;
437441

@@ -455,6 +459,9 @@ RenamerClangTidyCheck::addUsage(
455459
void RenamerClangTidyCheck::addUsage(const NamedDecl *Decl,
456460
SourceRange UsageRange,
457461
const SourceManager &SourceMgr) {
462+
if (SourceMgr.isInSystemHeader(Decl->getLocation()))
463+
return;
464+
458465
if (hasNoName(Decl))
459466
return;
460467

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
====================================================
2+
Extra Clang Tools |release| |ReleaseNotesTitle|
3+
====================================================
4+
5+
.. contents::
6+
:local:
7+
:depth: 3
8+
9+
Written by the `LLVM Team <https://llvm.org/>`_
10+
11+
.. only:: PreRelease
12+
13+
.. warning::
14+
These are in-progress notes for the upcoming Extra Clang Tools |version| release.
15+
Release notes for previous releases can be found on
16+
`the Download Page <https://releases.llvm.org/download.html>`_.
17+
18+
Introduction
19+
============
20+
21+
This document contains the release notes for the Extra Clang Tools, part of the
22+
Clang release |release|. Here we describe the status of the Extra Clang Tools in
23+
some detail, including major improvements from the previous release and new
24+
feature work. All LLVM releases may be downloaded from the `LLVM releases web
25+
site <https://llvm.org/releases/>`_.
26+
27+
For more information about Clang or LLVM, including information about
28+
the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or
29+
the `LLVM Web Site <https://llvm.org>`_.
30+
31+
Note that if you are reading this file from a Git checkout or the
32+
main Clang web page, this document applies to the *next* release, not
33+
the current one. To see the release notes for a specific release, please
34+
see the `releases page <https://llvm.org/releases/>`_.
35+
36+
What's New in Extra Clang Tools |release|?
37+
==========================================
38+
39+
Some of the major new features and improvements to Extra Clang Tools are listed
40+
here. Generic improvements to Extra Clang Tools as a whole or to its underlying
41+
infrastructure are described first, followed by tool-specific sections.
42+
43+
Major New Features
44+
------------------
45+
46+
Improvements to clangd
47+
----------------------
48+
49+
Inlay hints
50+
^^^^^^^^^^^
51+
52+
Diagnostics
53+
^^^^^^^^^^^
54+
55+
Semantic Highlighting
56+
^^^^^^^^^^^^^^^^^^^^^
57+
58+
Compile flags
59+
^^^^^^^^^^^^^
60+
61+
Hover
62+
^^^^^
63+
64+
Code completion
65+
^^^^^^^^^^^^^^^
66+
67+
Code actions
68+
^^^^^^^^^^^^
69+
70+
- New ``Override pure virtual methods`` code action. When invoked on a class
71+
definition, this action automatically generates C++ ``override`` declarations
72+
for all pure virtual methods inherited from its base classes that have not yet
73+
been implemented. The generated method stubs prompts the user for the actual
74+
implementation. The overrides are intelligently grouped under their original
75+
access specifiers (e.g., ``public``, ``protected``), creating new access
76+
specifier blocks if necessary.
77+
78+
Signature help
79+
^^^^^^^^^^^^^^
80+
81+
Cross-references
82+
^^^^^^^^^^^^^^^^
83+
84+
Objective-C
85+
^^^^^^^^^^^
86+
87+
Miscellaneous
88+
^^^^^^^^^^^^^
89+
90+
Improvements to clang-doc
91+
-------------------------
92+
93+
Improvements to clang-query
94+
---------------------------
95+
96+
- Matcher queries interpreted by clang-query are now support trailing comma (,)
97+
in matcher arguments. Note that C++ still doesn't allow this in function
98+
arguments. So when porting a query to C++, remove all instances of trailing
99+
comma (otherwise C++ compiler will just complain about "expected expression").
100+
101+
Improvements to clang-tidy
102+
--------------------------
103+
104+
- The :program:`run-clang-tidy.py` and :program:`clang-tidy-diff.py` scripts
105+
now run checks in parallel by default using all available hardware threads.
106+
Both scripts display the number of threads being used in their output.
107+
108+
New checks
109+
^^^^^^^^^^
110+
111+
- New :doc:`bugprone-invalid-enum-default-initialization
112+
<clang-tidy/checks/bugprone/invalid-enum-default-initialization>` check.
113+
114+
Detects default initialization (to 0) of variables with ``enum`` type where
115+
the enum has no enumerator with value of 0.
116+
117+
- New :doc:`llvm-mlir-op-builder
118+
<clang-tidy/checks/llvm/use-new-mlir-op-builder>` check.
119+
120+
Checks for uses of MLIR's old/to be deprecated ``OpBuilder::create<T>`` form
121+
and suggests using ``T::create`` instead.
122+
123+
New check aliases
124+
^^^^^^^^^^^^^^^^^
125+
126+
Changes in existing checks
127+
^^^^^^^^^^^^^^^^^^^^^^^^^^
128+
129+
- Improved :doc:`bugprone-infinite-loop
130+
<clang-tidy/checks/bugprone/infinite-loop>` check by adding detection for
131+
variables introduced by structured bindings.
132+
133+
- Improved :doc:`bugprone-reserved-identifier
134+
<clang-tidy/checks/bugprone/reserved-identifier>` check by ignoring
135+
declarations in system headers.
136+
137+
- Improved :doc:`bugprone-signed-char-misuse
138+
<clang-tidy/checks/bugprone/signed-char-misuse>` check by fixing
139+
false positives on C23 enums with the fixed underlying type of signed char.
140+
141+
- Improved :doc:`bugprone-unhandled-self-assignment
142+
<clang-tidy/checks/bugprone/unhandled-self-assignment>` check by adding
143+
an additional matcher that generalizes the copy-and-swap idiom pattern
144+
detection.
145+
146+
- Improved :doc:`misc-header-include-cycle
147+
<clang-tidy/checks/misc/header-include-cycle>` check performance.
148+
149+
- Improved :doc:`modernize-use-designated-initializers
150+
<clang-tidy/checks/modernize/use-designated-initializers>` check to
151+
suggest using designated initializers for aliased aggregate types.
152+
153+
- Improved :doc:`modernize-use-std-format
154+
<clang-tidy/checks/modernize/use-std-format>` check to correctly match
155+
when the format string is converted to a different type by an implicit
156+
constructor call.
157+
158+
- Improved :doc:`modernize-use-std-print
159+
<clang-tidy/checks/modernize/use-std-print>` check to correctly match
160+
when the format string is converted to a different type by an implicit
161+
constructor call.
162+
163+
- Improved :doc:`portability-template-virtual-member-function
164+
<clang-tidy/checks/portability/template-virtual-member-function>` check to
165+
avoid false positives on pure virtual member functions.
166+
167+
- Improved :doc:`readability-identifier-naming
168+
<clang-tidy/checks/readability/identifier-naming>` check by ignoring
169+
declarations in system headers.
170+
171+
- Improved :doc:`readability-qualified-auto
172+
<clang-tidy/checks/readability/qualified-auto>` check by adding the option
173+
`IgnoreAliasing`, that allows not looking at underlying types of type aliases.
174+
175+
Removed checks
176+
^^^^^^^^^^^^^^
177+
178+
Miscellaneous
179+
^^^^^^^^^^^^^
180+
181+
Improvements to include-fixer
182+
-----------------------------
183+
184+
The improvements are...
185+
186+
Improvements to clang-include-fixer
187+
-----------------------------------
188+
189+
The improvements are...
190+
191+
Improvements to modularize
192+
--------------------------
193+
194+
The improvements are...
195+
196+
Improvements to pp-trace
197+
------------------------
198+
199+
Clang-tidy Visual Studio plugin
200+
-------------------------------

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ Improvements to Clang's diagnostics
369369
Moved the warning for a missing (though implied) attribute on a redeclaration into this group.
370370
Added a new warning in this group for the case where the attribute is missing/implicit on
371371
an override of a virtual method.
372+
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right
373+
parenthesis when diagnosing malformed fold expressions. (#GH151787)
372374

373375
Improvements to Clang's time-trace
374376
----------------------------------

clang/include/clang/AST/ASTContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
13351335
return ExternalSource.get();
13361336
}
13371337

1338+
/// Retrieve a pointer to the external AST source associated
1339+
/// with this AST context, if any. Returns as an IntrusiveRefCntPtr.
1340+
IntrusiveRefCntPtr<ExternalASTSource> getExternalSourcePtr() const {
1341+
return ExternalSource;
1342+
}
1343+
13381344
/// Attach an AST mutation listener to the AST context.
13391345
///
13401346
/// The AST mutation listener provides the ability to track modifications to

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,24 @@ TARGET_BUILTIN(__builtin_amdgcn_cvt_scale_pk8_bf16_fp4, "V8yUiUiIUi", "nc", "gfx
721721
TARGET_BUILTIN(__builtin_amdgcn_cvt_scale_pk8_f32_fp8, "V8fV2UiUiIUi", "nc", "gfx1250-insts")
722722
TARGET_BUILTIN(__builtin_amdgcn_cvt_scale_pk8_f32_bf8, "V8fV2UiUiIUi", "nc", "gfx1250-insts")
723723
TARGET_BUILTIN(__builtin_amdgcn_cvt_scale_pk8_f32_fp4, "V8fUiUiIUi", "nc", "gfx1250-insts")
724+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp8_bf16, "V2UiV8yf", "nc", "gfx1250-insts")
725+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_bf8_bf16, "V2UiV8yf", "nc", "gfx1250-insts")
726+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp8_f16, "V2UiV8hf", "nc", "gfx1250-insts")
727+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_bf8_f16, "V2UiV8hf", "nc", "gfx1250-insts")
728+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp8_f32, "V2UiV8ff", "nc", "gfx1250-insts")
729+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_bf8_f32, "V2UiV8ff", "nc", "gfx1250-insts")
730+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp4_f32, "UiV8ff", "nc", "gfx1250-insts")
731+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp4_f16, "UiV8hf", "nc", "gfx1250-insts")
732+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_pk8_fp4_bf16, "UiV8yf", "nc", "gfx1250-insts")
733+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_bf16, "V2UiV8yUif", "nc", "gfx1250-insts")
734+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_bf16, "V2UiV8yUif", "nc", "gfx1250-insts")
735+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_f16, "V2UiV8hUif", "nc", "gfx1250-insts")
736+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_f16, "V2UiV8hUif", "nc", "gfx1250-insts")
737+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_f32, "V2UiV8fUif", "nc", "gfx1250-insts")
738+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_f32, "V2UiV8fUif", "nc", "gfx1250-insts")
739+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_f32, "UiV8fUif", "nc", "gfx1250-insts")
740+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_f16, "UiV8hUif", "nc", "gfx1250-insts")
741+
TARGET_BUILTIN(__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_bf16, "UiV8yUif", "nc", "gfx1250-insts")
724742
TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_fp8_f32_e5m3, "iffiIb", "nc", "fp8e5m3-insts")
725743
TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_fp8_f32_e5m3, "ifiiIi", "nc", "fp8e5m3-insts")
726744
TARGET_BUILTIN(__builtin_amdgcn_sat_pk4_i4_i8, "UsUi", "nc", "gfx1250-insts")
@@ -732,6 +750,10 @@ TARGET_BUILTIN(__builtin_amdgcn_permlane_down, "iiii", "nc", "gfx1250-insts,wave
732750
TARGET_BUILTIN(__builtin_amdgcn_permlane_xor, "iiii", "nc", "gfx1250-insts,wavefrontsize32")
733751
TARGET_BUILTIN(__builtin_amdgcn_permlane_idx_gen, "iii", "nc", "gfx1250-insts,wavefrontsize32")
734752

753+
TARGET_BUILTIN(__builtin_amdgcn_perm_pk16_b4_u4, "V2UiUiUiV2Ui", "nc", "tensor-cvt-lut-insts")
754+
TARGET_BUILTIN(__builtin_amdgcn_perm_pk16_b6_u4, "V3UiUiULiV2Ui", "nc", "tensor-cvt-lut-insts")
755+
TARGET_BUILTIN(__builtin_amdgcn_perm_pk16_b8_u4, "V4UiULiULiV2Ui", "nc", "tensor-cvt-lut-insts")
756+
735757
// GFX1250 WMMA builtins
736758
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x4_f32, "V8fIbV2fIbV2fIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")
737759
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x32_bf16, "V8fIbV16yIbV16yIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")

clang/include/clang/Frontend/ASTUnit.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,21 @@ class ASTUnit {
451451

452452
const SourceManager &getSourceManager() const { return *SourceMgr; }
453453
SourceManager &getSourceManager() { return *SourceMgr; }
454+
llvm::IntrusiveRefCntPtr<SourceManager> getSourceManagerPtr() {
455+
return SourceMgr;
456+
}
454457

455458
const Preprocessor &getPreprocessor() const { return *PP; }
456459
Preprocessor &getPreprocessor() { return *PP; }
457460
std::shared_ptr<Preprocessor> getPreprocessorPtr() const { return PP; }
458461

459462
const ASTContext &getASTContext() const { return *Ctx; }
460463
ASTContext &getASTContext() { return *Ctx; }
464+
llvm::IntrusiveRefCntPtr<ASTContext> getASTContextPtr() { return Ctx; }
461465

462-
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
466+
void setASTContext(llvm::IntrusiveRefCntPtr<ASTContext> ctx) {
467+
Ctx = std::move(ctx);
468+
}
463469
void setPreprocessor(std::shared_ptr<Preprocessor> pp);
464470

465471
/// Enable source-range based diagnostic messages.
@@ -495,6 +501,7 @@ class ASTUnit {
495501

496502
const FileManager &getFileManager() const { return *FileMgr; }
497503
FileManager &getFileManager() { return *FileMgr; }
504+
IntrusiveRefCntPtr<FileManager> getFileManagerPtr() { return FileMgr; }
498505

499506
const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
500507

@@ -803,8 +810,8 @@ class ASTUnit {
803810
std::shared_ptr<CompilerInvocation> CI,
804811
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
805812
std::shared_ptr<DiagnosticOptions> DiagOpts,
806-
IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FileManager *FileMgr,
807-
bool OnlyLocalDecls = false,
813+
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
814+
IntrusiveRefCntPtr<FileManager> FileMgr, bool OnlyLocalDecls = false,
808815
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
809816
unsigned PrecompilePreambleAfterNParses = 0,
810817
TranslationUnitKind TUKind = TU_Complete,
@@ -922,8 +929,9 @@ class ASTUnit {
922929
CodeCompleteConsumer &Consumer,
923930
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
924931
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diag,
925-
LangOptions &LangOpts, SourceManager &SourceMgr,
926-
FileManager &FileMgr,
932+
LangOptions &LangOpts,
933+
llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr,
934+
llvm::IntrusiveRefCntPtr<FileManager> FileMgr,
927935
SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics,
928936
SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers,
929937
std::unique_ptr<SyntaxOnlyAction> Act);

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class CompilerInstance : public ModuleLoader {
446446
}
447447

448448
/// Replace the current file manager and virtual file system.
449-
void setFileManager(FileManager *Value);
449+
void setFileManager(IntrusiveRefCntPtr<FileManager> Value);
450450

451451
/// @}
452452
/// @name Source Manager
@@ -471,7 +471,7 @@ class CompilerInstance : public ModuleLoader {
471471
}
472472

473473
/// setSourceManager - Replace the current source manager.
474-
void setSourceManager(SourceManager *Value);
474+
void setSourceManager(llvm::IntrusiveRefCntPtr<SourceManager> Value);
475475

476476
/// @}
477477
/// @name Preprocessor
@@ -516,7 +516,7 @@ class CompilerInstance : public ModuleLoader {
516516
}
517517

518518
/// setASTContext - Replace the current AST context.
519-
void setASTContext(ASTContext *Value);
519+
void setASTContext(llvm::IntrusiveRefCntPtr<ASTContext> Value);
520520

521521
/// Replace the current Sema; the compiler instance takes ownership
522522
/// of S.

clang/include/clang/Frontend/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void AttachHeaderIncludeGen(Preprocessor &PP,
189189
/// memory, mainly for testing.
190190
IntrusiveRefCntPtr<ExternalSemaSource>
191191
createChainedIncludesSource(CompilerInstance &CI,
192-
IntrusiveRefCntPtr<ExternalSemaSource> &Reader);
192+
IntrusiveRefCntPtr<ASTReader> &OutReader);
193193

194194
/// Optional inputs to createInvocation.
195195
struct CreateInvocationOptions {

0 commit comments

Comments
 (0)