[clang] [lldb] [clang] Add -ast-dump-filter-path to filter AST dump by file path (PR #194266)
Taufiq Rahman via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 18:35:20 PDT 2026
https://github.com/Inconnu08 updated https://github.com/llvm/llvm-project/pull/194266
>From 19488bbb1206fb149042c42636433bc9a910c795 Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Sun, 26 Apr 2026 16:41:03 -0400
Subject: [PATCH 1/5] [clang] Add -ast-dump-filter-path to filter AST dump by
file path
---
clang/include/clang/Frontend/ASTConsumers.h | 11 ++--
.../include/clang/Frontend/FrontendOptions.h | 3 +
clang/include/clang/Options/Options.td | 7 ++
clang/lib/Frontend/ASTConsumers.cpp | 65 ++++++++++++++-----
clang/lib/Frontend/FrontendActions.cpp | 6 +-
clang/tools/clang-check/ClangCheck.cpp | 1 +
.../clang-import-test/clang-import-test.cpp | 2 +-
.../TypeSystem/Clang/TypeSystemClang.cpp | 1 +
8 files changed, 70 insertions(+), 26 deletions(-)
diff --git a/clang/include/clang/Frontend/ASTConsumers.h b/clang/include/clang/Frontend/ASTConsumers.h
index 890701b6ff188ee..0650f16df3aab52 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -32,13 +32,14 @@ std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS,
// stream, or stdout if OS is nullptr.
std::unique_ptr<ASTConsumer>
CreateASTDumper(std::unique_ptr<raw_ostream> OS, StringRef FilterString,
- bool DumpDecls, bool Deserialize, bool DumpLookups,
- bool DumpDeclTypes, ASTDumpOutputFormat Format);
+ StringRef FilterPath, bool DumpDecls, bool Deserialize,
+ bool DumpLookups, bool DumpDeclTypes,
+ ASTDumpOutputFormat Format);
std::unique_ptr<ASTConsumer>
-CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
- bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
- ASTDumpOutputFormat Format);
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, StringRef FilterPath,
+ bool DumpDecls, bool Deserialize, bool DumpLookups,
+ bool DumpDeclTypes, ASTDumpOutputFormat Format);
// AST Decl node lister: prints qualified names of all filterable AST Decl
// nodes.
diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h
index b85cf4c0078628a..cb32509aa09e2c3 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -461,6 +461,9 @@ class FrontendOptions {
/// If given, filter dumped AST Decl nodes by this substring.
std::string ASTDumpFilter;
+ /// If given, filter dumped AST Decl nodes by source file path (glob pattern).
+ std::string ASTDumpFilterPath;
+
/// If given, enable code completion at the provided location.
ParsedSourceLocation CodeCompletionAt;
diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td
index 5fb5b75e15a19f5..c6c73afb698f9e0 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -8658,6 +8658,13 @@ def ast_dump_filter : Separate<["-"], "ast-dump-filter">,
MarshallingInfoString<FrontendOpts<"ASTDumpFilter">>;
def ast_dump_filter_EQ : Joined<["-"], "ast-dump-filter=">,
Alias<ast_dump_filter>;
+def ast_dump_filter_path : Separate<["-"], "ast-dump-filter-path">,
+ MetaVarName<"<path_filter>">,
+ HelpText<"Use with -ast-dump or -ast-print to dump/print only AST declaration"
+ " nodes whose source file path matches a glob pattern.">,
+ MarshallingInfoString<FrontendOpts<"ASTDumpFilterPath">>;
+def ast_dump_filter_path_EQ : Joined<["-"], "ast-dump-filter-path=">,
+ Alias<ast_dump_filter_path>;
def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">,
HelpText<"Do not automatically generate or update the global module index">,
MarshallingInfoNegativeFlag<FrontendOpts<"UseGlobalModuleIndex">>;
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp
index 40995e32b67fa9d..e7f4e00c2c5b79a 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -18,8 +18,11 @@
#include "clang/AST/RecordLayout.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/Diagnostic.h"
-#include "llvm/Support/Timer.h"
+#include "clang/Basic/SourceManager.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/GlobPattern.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Timer.h"
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -34,22 +37,24 @@ namespace {
enum Kind { DumpFull, Dump, Print, None };
ASTPrinter(std::unique_ptr<raw_ostream> Out, Kind K,
ASTDumpOutputFormat Format, StringRef FilterString,
- bool DumpLookups = false, bool DumpDeclTypes = false)
+ StringRef FilterPath, bool DumpLookups = false,
+ bool DumpDeclTypes = false)
: Out(Out ? *Out : llvm::outs()), OwnedOut(std::move(Out)),
OutputKind(K), OutputFormat(Format), FilterString(FilterString),
- DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
+ FilterPath(FilterPath), DumpLookups(DumpLookups),
+ DumpDeclTypes(DumpDeclTypes) {}
ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
- StringRef FilterString, bool DumpLookups = false,
- bool DumpDeclTypes = false)
+ StringRef FilterString, StringRef FilterPath,
+ bool DumpLookups = false, bool DumpDeclTypes = false)
: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
- FilterString(FilterString), DumpLookups(DumpLookups),
- DumpDeclTypes(DumpDeclTypes) {}
+ FilterString(FilterString), FilterPath(FilterPath),
+ DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
void HandleTranslationUnit(ASTContext &Context) override {
TranslationUnitDecl *D = Context.getTranslationUnitDecl();
- if (FilterString.empty())
+ if (FilterString.empty() && FilterPath.empty())
return print(D);
TraverseDecl(D);
@@ -84,7 +89,28 @@ namespace {
return "";
}
bool filterMatches(Decl *D) {
- return getName(D).find(FilterString) != std::string::npos;
+ if (!FilterString.empty() &&
+ getName(D).find(FilterString) == std::string::npos)
+ return false;
+
+ if (!FilterPath.empty()) {
+ const SourceManager &SM = D->getASTContext().getSourceManager();
+
+ SourceLocation Loc = SM.getSpellingLoc(D->getLocation());
+ if (Loc.isInvalid())
+ return false;
+
+ auto Pattern = llvm::GlobPattern::create(FilterPath);
+ if (!Pattern) {
+ llvm::consumeError(Pattern.takeError());
+ return false;
+ }
+
+ if (!Pattern->match(SM.getFilename(Loc)))
+ return false;
+ }
+
+ return true;
}
void print(Decl *D) {
if (DumpLookups) {
@@ -134,6 +160,9 @@ namespace {
/// Which declarations or DeclContexts to display.
std::string FilterString;
+ /// Which source file paths to display.
+ std::string FilterPath;
+
/// Whether the primary output is lookup results or declarations. Individual
/// results will be output with a format determined by OutputKind. This is
/// incompatible with OutputKind == Print.
@@ -170,32 +199,34 @@ std::unique_ptr<ASTConsumer>
clang::CreateASTPrinter(std::unique_ptr<raw_ostream> Out,
StringRef FilterString) {
return std::make_unique<ASTPrinter>(std::move(Out), ASTPrinter::Print,
- ADOF_Default, FilterString);
+ ADOF_Default, FilterString, "");
}
std::unique_ptr<ASTConsumer>
clang::CreateASTDumper(std::unique_ptr<raw_ostream> Out, StringRef FilterString,
- bool DumpDecls, bool Deserialize, bool DumpLookups,
+ StringRef FilterPath, bool DumpDecls,
+ bool Deserialize, bool DumpLookups,
bool DumpDeclTypes, ASTDumpOutputFormat Format) {
assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
return std::make_unique<ASTPrinter>(
std::move(Out),
Deserialize ? ASTPrinter::DumpFull
: DumpDecls ? ASTPrinter::Dump : ASTPrinter::None,
- Format, FilterString, DumpLookups, DumpDeclTypes);
+ Format, FilterString, FilterPath, DumpLookups, DumpDeclTypes);
}
std::unique_ptr<ASTConsumer>
-clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool DumpDecls,
- bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
- ASTDumpOutputFormat Format) {
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString,
+ StringRef FilterPath, bool DumpDecls,
+ bool Deserialize, bool DumpLookups,
+ bool DumpDeclTypes, ASTDumpOutputFormat Format) {
assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
return std::make_unique<ASTPrinter>(Out,
Deserialize ? ASTPrinter::DumpFull
: DumpDecls ? ASTPrinter::Dump
: ASTPrinter::None,
- Format, FilterString, DumpLookups,
- DumpDeclTypes);
+ Format, FilterString, FilterPath,
+ DumpLookups, DumpDeclTypes);
}
std::unique_ptr<ASTConsumer> clang::CreateASTDeclNodeLister() {
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index a7859aeb8e130c0..4e041ee875b9ab3 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -88,9 +88,9 @@ std::unique_ptr<ASTConsumer>
ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
const FrontendOptions &Opts = CI.getFrontendOpts();
return CreateASTDumper(nullptr /*Dump to stdout.*/, Opts.ASTDumpFilter,
- Opts.ASTDumpDecls, Opts.ASTDumpAll,
- Opts.ASTDumpLookups, Opts.ASTDumpDeclTypes,
- Opts.ASTDumpFormat);
+ Opts.ASTDumpFilterPath, Opts.ASTDumpDecls,
+ Opts.ASTDumpAll, Opts.ASTDumpLookups,
+ Opts.ASTDumpDeclTypes, Opts.ASTDumpFormat);
}
std::unique_ptr<ASTConsumer>
diff --git a/clang/tools/clang-check/ClangCheck.cpp b/clang/tools/clang-check/ClangCheck.cpp
index 7672b59b3548259..eee50759671bc1c 100644
--- a/clang/tools/clang-check/ClangCheck.cpp
+++ b/clang/tools/clang-check/ClangCheck.cpp
@@ -178,6 +178,7 @@ class ClangCheckActionFactory {
return clang::CreateASTDeclNodeLister();
if (ASTDump)
return clang::CreateASTDumper(nullptr /*Dump to stdout.*/, ASTDumpFilter,
+ /*FilterPath=*/"",
/*DumpDecls=*/true,
/*Deserialize=*/false,
/*DumpLookups=*/false,
diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp
index d555ecffee9fb04..21350cf7cd32269 100644
--- a/clang/tools/clang-import-test/clang-import-test.cpp
+++ b/clang/tools/clang-import-test/clang-import-test.cpp
@@ -324,7 +324,7 @@ llvm::Expected<CIAndOrigins> Parse(const std::string &Path,
auto &CG = *static_cast<CodeGenerator *>(ASTConsumers.back().get());
if (ShouldDumpAST)
- ASTConsumers.push_back(CreateASTDumper(nullptr /*Dump to stdout.*/, "",
+ ASTConsumers.push_back(CreateASTDumper(nullptr /*Dump to stdout.*/, "", "",
true, false, false, false,
clang::ADOF_Default));
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f17209d890aa007..f3e8baaf38453d2 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8534,6 +8534,7 @@ void TypeSystemClang::Dump(llvm::raw_ostream &output, llvm::StringRef filter,
auto consumer =
clang::CreateASTDumper(output, filter,
+ /*FilterPath=*/"",
/*DumpDecls=*/true,
/*Deserialize=*/false,
/*DumpLookups=*/false,
>From 29a27ebd2829dbc085de47c1514988ae2c41418a Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Thu, 7 May 2026 23:03:39 -0400
Subject: [PATCH 2/5] [clang] Address review feedback: use presumed loc, add
tests and release note
---
clang/docs/ReleaseNotes.md | 391 +-----------------
clang/include/clang/Options/Options.td | 2 +-
clang/lib/Frontend/ASTConsumers.cpp | 11 +-
clang/test/AST/ast-dump-filter-path-include.c | 7 +
clang/test/AST/ast-dump-filter-path.c | 8 +
clang/test/AST/filter-header.h | 1 +
6 files changed, 40 insertions(+), 380 deletions(-)
create mode 100644 clang/test/AST/ast-dump-filter-path-include.c
create mode 100644 clang/test/AST/ast-dump-filter-path.c
create mode 100644 clang/test/AST/filter-header.h
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 929892fd34f7fcd..007e1f8131ab9f2 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -12,6 +12,10 @@ myst:
{#clang-release-releasenotestitle}
# Clang {{ (('(In-Progress) ' if env.app.tags.has('PreRelease') else '') ~ 'Release Notes') if env.config.project == 'Clang' else '|ReleaseNotesTitle|' }}
+```{contents}
+:depth: 2
+:local:
+```
Written by the [LLVM Team](https://llvm.org/)
@@ -50,11 +54,6 @@ in a future version of Clang.
### C++ Specific Potentially Breaking Changes
-- The `[[carries_dependency]]` attribute is no longer recognized, in any language
- mode, as it was removed from the standard by
- [P3475R2](https://wg21.link/P3475R2).
-
-
### Objective-C Specific Potentially Breaking Changes
- Fixed an issue where AST consumers based on `RecursiveASTVisitor` would bypass
@@ -74,7 +73,7 @@ features cannot lower the translation-unit ABI level;
- On SPARC, a `_Complex` value with an integer element type is now passed and
returned packed into the one or two integer registers it fits in, matching GCC.
Clang previously passed such a value indirectly and returned it with one part
- per register.
+ per register.
`-fclang-abi-compat=23` restores the previous behavior. (#GH212340)
- On SPARC64, a `_Complex char` or `_Complex short` is now
@@ -97,31 +96,12 @@ features cannot lower the translation-unit ABI level;
- On MIPS N32/N64, an `__int128` now correctly start in an even-numbered register
or 16-byte aligned stack slot, matching GCC.
-- Except on PlayStation, on x86-64 System V a non-zero-width unnamed bit-field
- now classifies the eightbytes it occupies as INTEGER, like a named bit-field,
- matching GCC. Aggregates where this changes the classification may be passed
- or returned differently -- a struct holding a run of `__int128` bit-fields,
- for example, now travels in the two integer registers the ABI assigns it.
- This also fixes a crash when such a struct was passed or returned.
- `-fclang-abi-compat=23` restores the previous behavior. (#GH202205)
-
-- Clang now considers matrix types in its isHomogeneousAggregate() handling,
- which can lead to differences in how structures containing matrix types are
- classified for ABI purposes. The previous exclusion of matrix types appears
- to have been accidental. Matrix types now follow the same rules as arrays
- for homogeneous aggregate classification.
- `-fclang-abi-compat=23` restores the previous behavior. (#GH218799)
-
### AST Dumping Potentially Breaking Changes
### Clang Frontend Potentially Breaking Changes
- Templight support has been removed.
-- `-fstack-clash-protection` has been enabled implicitly by default for android
- target triples (except 32b arm targets). Can be disabled via
- `-fno-stack-clash-protection`.
-
### Clang Python Bindings Potentially Breaking Changes
- `CompletionChunkKind` instance's `__str__` representation has been adapted to be consistent with other enums in the library.
@@ -139,9 +119,7 @@ features cannot lower the translation-unit ABI level;
- `CompletionString.availability` now returns instances of `AvailabilityKind`.
As a result, the `__str__` representation of its return values changed.
- Like other libclang enums, it now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`.
-
-- `Cursor` instance's `enum_value` method now returns 1 instead of -1 for `true` bool enumeration values
+ Like other libclang enums, it now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`.
### OpenCL Potentially Breaking Changes
@@ -172,17 +150,10 @@ features cannot lower the translation-unit ABI level;
- Clang now supports [P3533R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3533r2.html) (constexpr virtual inheritance).
-- Implemented the language part of [P3475R2](https://wg21.link/P3475R2) (Defang
- and deprecate `memory_order::consume`) by removing support for the
- `[[carries_dependency]]` attribute.
-
#### C++23 Feature Support
#### C++20 Feature Support
-- Now clang-scan-deps in P1689 format can find the dependencies described in
- module map file. See the documents of standard C++ modules for details.
-
#### C++17 Feature Support
#### Resolutions to C++ Defect Reports
@@ -190,10 +161,6 @@ features cannot lower the translation-unit ABI level;
- Clang now falls back to alignment-aware allocation functions for
non-overaligned types, implementing [CWG2282](https://wg21.link/cwg2282).
-- Clang now converts floating-point values to boolean first when converting
- them to an enumeration type with a fixed `bool` underlying type. This
- resolves [CWG1094](https://wg21.link/cwg1094).
-
### C Language Changes
#### C2y Feature Support
@@ -238,18 +205,9 @@ features cannot lower the translation-unit ABI level;
- Clang tools now resolve tool names without a path in compilation databases
through `PATH`.
-- On musl targets, the driver now links ``libssp_nonshared.a`` when stack
- protection is enabled and the library is present in the toolchain library
- paths, matching what musl distributions configure GCC to do.
-
- Clang now allows GNU computed `goto` extension in `constexpr` functions, matching the relaxed
`constexpr` function body rules introduced in C++23.
-- Added support for the `__builtin_strlcat` and `__builtin_strlcpy` builtins.
-
-- Added `__builtin_sort_pack` to sort a pack of types using the same
- order as `__builtin_type_order`.
-
### New Compiler Flags
- New option `-fdefined-pointer-subtraction` added to preserve stable semantics
@@ -276,43 +234,25 @@ features cannot lower the translation-unit ABI level;
unit to be emitted into the object file, even when they are inlined into all
callers or are otherwise unused.
+- Added a new `-ast-dump-filter-path` option to filter AST dump output
+ based on the source file path of declarations. The filter uses glob-style
+ matching on the presumed source location (accounting for macro expansions
+ and `#line` directives). (#GH194210)
+
### Deprecated Compiler Flags
### Modified Compiler Flags
- All options of the `-fzero-call-used-regs` compiler flag are now allowed on RISC-V.
-- `-ftrivial-auto-var-init=` now initializes variables whose declaration is
- bypassed by a `goto` or `switch`, which were previously left uninitialized.
- The initialization is emitted at each bypassing jump. See the
- `-ftrivial-auto-var-init=` entry in the User's Manual for the details,
- including where C deliberately departs from C 6.2.4p6.
-
### Removed Compiler Flags
### Attribute Changes in Clang
- Clang now properly propagates attributes on class and variable templates to their redeclarations, which will result in redeclarations not interfering with diagnostics. (#GH209812)
-- Clang now recognizes the `[[gnu::flag_enum]]` attribute and treats it equivalent to `[[clang::flag_enum]]`
-
-- Clang now accepts `_single_inheritance` under `-fms-compatibility` as an alias for `__single_inheritance`; `_multiple_inheritance` and `_virtual_inheritance` were already correctly supported as aliases.
-
### Improvements to Clang's diagnostics
-- `-Wfortify-source` now diagnoses when `strlcat`, `__builtin_strlcat`, `strlcpy`, or
- `__builtin_strlcpy` is called with a size argument larger than the destination buffer.
-
-- `-Wfortify-source` now diagnoses when `recv` or `recvfrom` is called with a
- size argument larger than the destination buffer.
-
-- `-Wfortify-source` now diagnoses when `poll`, `ppoll`, or `ppoll64` is called
- with a descriptor count whose total size exceeds the `fds` array size.
-
-- The `cannot overload a member function` diagnostic now describes the previous
- declaration first, matching the order in which the declarations appear in the
- source. (#GH219803)
-
- More consistent rendering of Unicode characters in diagnostic messages.
- Fixed `-Wunused-parameter` to diagnose coroutine parameters that are only
@@ -320,20 +260,9 @@ features cannot lower the translation-unit ABI level;
initialization, while not diagnosing parameters passed to the selected
allocation function or promise constructor. (#GH217501)
-- The `wb` and `uwb` `_BitInt` literal suffixes are no longer diagnosed by default
- before C23. They stay in `-Wc23-extensions` and are still reported under
- `-pedantic` or when that group is enabled explicitly, matching how the `_BitInt`
- type itself is already handled.
-
- Fixed bug in `-Wdocumentation` so that it correctly handles explicit
function template instantiations (#64087).
-- When a `constexpr` range-based for loop variable cannot be initialized by a
- constant expression, Clang now emits a single note identifying the read of
- the loop's implicit `__begin` variable, instead of a generic note about
- reading a non-constexpr variable followed by a `declared here` note.
- (#GH211926)
-
- Fixed concept template parameters not being recognized in `-Wdocumentation`
when mentioned in tparam comments. (#GH64087)
@@ -401,9 +330,6 @@ features cannot lower the translation-unit ABI level;
};
```
-- Lifetime safety analysis is now enabled for C by default. The `-fexperimental-lifetime-safety-c`
- flag is renamed to `-flifetime-safety-c`. Use `-fno-lifetime-safety-c` to disable it.
-
- Improved `-Wassign-enum` performance by caching enum enumerator values. (#GH176454)
- Fixed a false negative in `-Warray-bounds` where the warning was suppressed
@@ -482,9 +408,6 @@ features cannot lower the translation-unit ABI level;
- Diagnostics for the C++11 range-based for statement now report the correct
iterator type in notes for invalid iterator types.
-- `-Wfortify-source` now diagnoses calls to `fread`, `fwrite`, and `fgets`
- when the requested size exceeds the corresponding buffer. (#GH204337)
-
- `-Wfortify-source` now warns when the constant-evaluated argument to
`umask` has bits set outside `0777`. Those bits are silently discarded
by the kernel, so setting them is almost always a typo (matching the
@@ -510,42 +433,8 @@ features cannot lower the translation-unit ABI level;
- `-Wc++98-compat` now diagnoses explicit conversion functions in C++20 and
later, matching the behavior in C++11 through C++17. (#GH161689)
-- Added `-Wcounter-extension` as a diagnostic group under `-Wc2y-extensions` to
- control `__COUNTER__` being diagnosed as an extension. This allows `-pedantic`
- users to disable the diagnostic with `-Wno-counter-extension` without having
- to disable all pedantic diagnostics. (#GH196557)
-
- Clang now diagnoses more details when a constraint evaluates to false.
-- `-Wpointer-arith` no longer reports subtraction of pointers to a variably
- modified type, such as `int[n]`, as a subtraction of pointers to a type of
- zero size, unless the size is provably zero: a zero-sized base element or a
- dimension that is a zero integer constant, as in `struct Empty vla[n]` or
- `int vla[n][0]`. (#GH28328)
-
-- Fixed a missing `-Wconstant-conversion` diagnostic for signed `char` arrays.
-
-- Clang now diagnoses passing wrong vector type as a mask to `__builtin_shufflevector`. (#GH218132)
-
-- `-Wdelete-abstract-non-virtual-dtor` and `-Wdelete-non-abstract-non-virtual-dtor`
- no longer warn when the selected deallocation function is a destroying
- `operator delete`, since such a delete expression never invokes the
- destructor. (#GH65524)
-
-- Fixed a false-positive `-Wshadow` warning when a variable in an
- inline-defined friend function shares the name of a non-static class
- member variable. (#GH221190)
-
-- Clang now diagnoses matrix logical operations are only supported for HLSL. (#GH222381)
-
-- Improve the input size mismatch diagnostic when calling `__builtin_shufflevector` with valid
- vector element types but different sizes. (#GH221791)
-
-- Suggests the correct location for an attribute written before the `using`
- keyword of an alias-declaration. (#GH155787)
-
-- Improve Clang diagnoses when unary `__imag` operator with non-complex type operand is used as lvalue. (#GH222383)
-
### Improvements to Clang's time-trace
### Improvements to Coverage Mapping
@@ -553,7 +442,6 @@ features cannot lower the translation-unit ABI level;
### Bug Fixes in This Version
- Fixed incorrect handling of C++ import preprocessing token when a digraph character after import. (#GH190693)
-- Fixed a crash when emitting RTTI for a `dllexport` class, or the fundamental type descriptors for `__cxxabiv1::__fundamental_type_info`, under `-fvisibility=hidden`. (#GH207963)
- Fixed an assertion failure when passing a wide string literal to `__builtin_nan`. (#GH212108)
- Fixed a constraint comparison bug in partial ordering. (#GH182671)
- Fixed a rejected-valid case that used an explicit object parameter in an out-of-line definition of a nested class member. (#GH136472)
@@ -562,9 +450,7 @@ features cannot lower the translation-unit ABI level;
- Fixed USR generation for declarations whose signature mentions a class-type
non-type template parameter. (#GH212351)
- Fixed an assertion caused by Microsoft integer literals exceeding the maximum value. (#GH212504)
-- Fixed an assertion failure when a value of a Unicode character type (`char8_t`, `char16_t`, `char32_t`) was implicitly splatted to a vector of the same element type, e.g. when comparing an `ext_vector_type` of `char32_t` with one of its elements. (#GH202317)
- Fixed a crash when checking scalar type with excess braces. (#GH69213), (#GH137845), (#GH198767), (#GH207566), (#GH106180)
-- Fixed an assertion failure when a global variable in a non-default address space, such as one declared with `__seg_gs`, is mapped into an OpenMP `target` region. (#GH140069)
- Fixed an assertion crash when instantiating a nested requirement with an invalid constraint. (#GH213575)
- Clang now defines the GCC-compatible predefined macro `__SIG_ATOMIC_TYPE__`. (#GH213895)
- Fixed IEEE f128 complex mul/div using the IBM f128 libcalls on powerpc. (#GH216820)
@@ -572,46 +458,20 @@ features cannot lower the translation-unit ABI level;
- Fixed a bug where a stray closing curley brace in an OpenMP/OpenACC pragma could cause pragma parsing issues when inside of a member function. (#GH214195)
- Fixed a bug where preprocessor directives following comments were not correctly recognized when using -C. (#GH48361)
- Fixed a crash when declaring a member template within a local class inside an OpenMP region. (#GH216052)
-- Fixed an assertion failure when a variable implicitly mapped by an OpenMP `target` directive has a class type
- (such as `std::map`) whose mapper lookup instantiates a class template specialization. (#GH154704)
- Fixed a bug where repeated #imports of modular headers in non-modular compilation were translated to #pragma clang module import. (#GH216924)
- Fixed an assertion when `#pragma omp declare simd` or `#pragma omp declare variant` is followed by another OpenMP declarative directive containing a qualified identifier. (#GH217204)
-- Fixed crashes on an OpenMP `target` region inside a lambda or block at namespace scope, including when the region used a global reference. (#GH223397)
-- Fixed a crash when an `asm` label names the register for a global variable of incomplete type. (#GH219746)
-- Fixed an ICE hat occurred when using `__imag int/float` as lvalue in assignment. (#GH119498)
-- Fixed an assertion failure in `-Wsign-compare` when a negated or complemented vector of unsigned integers was compared against a signed constant. (#GH203575)
-- Fixed an assertion failure when a constant statement expression that declares a variable is used as a bound of an OpenMP loop. A statement expression in a bound of a non-rectangular loop is now diagnosed. (#GH153987)
-- Fixed a bug where a bit-field accessed as the result of a statement expression
- (e.g. `({ s.b; })`) was not subject to integer promotion, unlike an ordinary
- bit-field access. (#GH221542)
-- No longer crashing due to follow-on diagnostics when there is an invalid operand in a logical operator involving a vector operand. (#GH227588)
-- Fixed assertion failures caused by stale linkage information when an extern variable or function declaration is merged with a preceding static declaration. (#GH204759, #GH204754)
-- Fixed a crash due to typo correction mishandling custom keywords `_virtual_inheritance` and `_multiple_inheritance` in `-fms-compatibility` mode. (#GH228003)
-
+
#### Bug Fixes to Compiler Builtins
- Fixed a crash when classifying a call to a builtin with dependent arguments,
such as when the call is used as an `auto` non-type template argument.
-- Fixed an assertion failure when diagnosing a constant evaluation failure
- inside a member function call synthesized by ``__builtin_invoke``. (#GH185241)
- Fixed a crash in ``__builtin_dump_struct`` when ``-Werror`` promotes
format warnings to errors. (#GH211943)
-- Fixed wrong code generation in `__builtin_clear_padding` wherein the wrong
- bits of the following types were cleared: `_BitInt`, struct bitfields, and
- packed boolean vectors. (#GH215809), (#GH216063), (#GH224033)
-- Fixed an assertion failure when `__builtin_vectorelements` is applied to a
- reference to a vector type; `vec_step` (in C++ for OpenCL) and
- `__builtin_ptrauth_type_discriminator` similarly no longer accept reference
- types that their evaluation silently mishandled. (#GH216997)
#### Bug Fixes to Attribute Support
- Fixed crash (assertion) when the `alloc_align` attribute was applied to a declaration whose type has a `FunctionProtoType` but which is not itself a `FunctionDecl`, such as a function-pointer variable. (#GH122058)
-- Fixed a crash on `bool` vectors declared with `ext_vector_type` and more than
- 2^23 elements; `ext_vector_type` and `vector_size` now both reject vectors
- with more than 2^23 elements or larger than 2^28 bytes. (#GH165458)
-
- The `counted_by`/`counted_by_or_null` diagnostic that rejects a pointer whose
pointee is a struct with a flexible array member (e.g.
``struct with_fam * __sized_by(size) ptr;``) was incorrectly also applied to
@@ -625,41 +485,15 @@ features cannot lower the translation-unit ABI level;
#### Bug Fixes to C++ Support
-- Fixed lambdas with specifiers or attributes after the capture list being
- misparsed as function declarations in direct-initialization contexts under
- `-fms-extensions` or in HLSL mode.
-
-- Fixed the destruction timing of temporaries created by default member
- initializers during aggregate initialization. Such an initializer is part of
- the full-expression containing the aggregate initialization. (#GH85601)
-
-- Fixed false-positive module ODR diagnostics when a type is found through a
- using-declaration in one definition and directly in another. ODR hashing also
- now distinguishes differently qualified uses of types found through
- using-declarations. (#GH78850)
-- Fixed an assertion when diagnosing module ODR violations for enum underlying
- types found through using-declarations with the same name but different types.
-
-- Fixed a false type mismatch when a typedef naming an anonymous enumeration
- was used through a C++20 named module and its defining header was subsequently
- included. (#GH213299)
-
- Fixed an issue where `__typeof__` incorrectly rejected cv-qualified function types.
-- Fixed an assertion failure when `#embed` was used in the braced initializer
- of an array new-expression, or of an array whose elements are of class type.
- (#GH128985)
-
- Fixed a bug where top-level CV qualifiers (such as ``const``) were dropped from pointers modified by Microsoft pointer attributes (like ``__ptr32`` and ``__ptr64``) and WebAssembly's ``__funcref``.
-- Fixed a bug where we accepted ``__super`` being qualified by a scope specifier, causing codegen to assertion fail elsewhere. (#GH212988)
- Fixed an issue where we tried to compare invalid NTTPs for variable declarations, which ended up in hitting an assertion with a constrained non-plain-auto NTTP, which we don't quite implement yet. (#GH208658)
- Fixed a crash when a using-declaration naming an unresolvable member of a
dependent base was shadowed by an invalid using-declaration. (#GH209427)
-- Fixed a CTAD bug when combining with concepts. (#GH124715)
-
- Fixed a regression where an internal-linkage function (e.g. a `static` or
anonymous-namespace helper) declared in the global module fragment of the
current translation unit was removed from the overload set when the calling
@@ -670,9 +504,6 @@ features cannot lower the translation-unit ABI level;
- Fixed a crash when module directive export module foo not following a
semicolon and there are no rest pp-tokens in current module file. (#GH187771)
-- Fixed concept evaluation bugs where some declarations were not added to
- the current instantiation scope. (#GH198052)
-
- Fixed a crash when a lambda parameter pack was given a default argument that
is a pack expansion referencing an enclosing function's parameter pack (e.g.
`[](Types... = args...) {}`). Clang now diagnoses the illegal default
@@ -690,11 +521,6 @@ features cannot lower the translation-unit ABI level;
operator required an access check that ran while an enclosing declaration
was still being parsed. (#GH210692)
-- Fixed an assertion when a call to a class object was resolved through a
- conversion function to a function pointer that was introduced into the class
- by a using-declaration (e.g. `using Base::operator auto;`). Such a conversion
- function is now also diagnosed if it is deleted. (#GH189146)
-
- A workaround that was introduced to fix an issue with the `<format>` header present in some versions of
libstdc++15 has been extended to support preprocessed input. Previously, splitting the preprocessing and
compilation step would result in the fix not being applied. (#GH160314)
@@ -709,16 +535,6 @@ features cannot lower the translation-unit ABI level;
affect C++26 constexpr structured bindings and expansion statements, but
also affects some uses of plain structured bindings. (#GH211930)
-- Fixed an assertion when instantiating the body of a C++26 expansion
- statement after a fatal error had occurred. (#GH214917)
-
-- Fixed an assertion when an invalid statement appeared in a ``switch``
- statement nested inside a C++26 expansion statement. (#GH210575)
-
-- Fixed an assertion when a ``matrix_type`` with constant dimensions and a
- dependent element type was instantiated with an invalid element type.
- (#GH202744)
-
- Fixed friend declarations sometimes making non-visible default arguments
incorrectly visible to default argument redefinition checks across modules.
@@ -727,13 +543,6 @@ features cannot lower the translation-unit ABI level;
using ``__is_constructible`` on a nested class template inside the definition
of the containing class. (#GH215166)
-- Fixed a crash issue when a value dependent recovery init appeared in constant
- evaluation context in default constant evaluator.
-
-- Fixed a bug where Clang incorrectly required `promise.return_value()` for a
- dependent `co_return` operand that inits to `void`, instead of using
- `promise.return_void()`. (#GH218368)
-
- Fixed merging of lambdas across modules in the case where neither lambda is
imported from an AST file. (#GH214560)
@@ -741,75 +550,17 @@ features cannot lower the translation-unit ABI level;
to a subobject and is used in a context that requires an implicit conversion.
(#GH215900)
-- Fixed an assertion when mangling an abbreviated function template whose
- return type has an ABI tag. (#GH204178)
-
- Fixed an assertion during template argument deduction where a function parameter pack is referenced by other types in the function type. (#GH28877), (#GH213760)
-- Fixed a regression where deprecation warnings were omitted for synthesized
- deduction guide. (#GH160543)
-
- Fixed an assertion when a redeclaration of a function template or an out-of-line
definition of a member of a class template added a default argument to a
parameter that follows a parameter pack (e.g.
`template <typename... T> S::S(T..., int = 10) {}`). (#GH216211)
-- Fixed an assertion failure when instantiating a late-parsed function template defined in an earlier translation unit with -fdelayed-template-parsing. (#GH217073)
-
-- Allow redeclaration lookup to consider conversion function templates, allowing
- Clang to match an in-class specialization such as `template<> operator int()`
- against a prior conversion function template `template<class T> operator T()`.
- (#GH218261)
- Fixed an assertion when an ill-formed qualified member function definition
inside a union caused the union to be treated as a polymorphic class.
(#GH213854)
-- Fixed a crash, a miscompile and a rejected-valid case when instantiating a
- constructor whose mem-initializer used parenthesized aggregate initialization,
- e.g. ``: agg({1, 2})`` or ``: arr(1, 2)``. (#GH176161, #GH189005, #GH213284)
-
-- Fixed an assertion when a type-trait keyword that had already been made
- available as an identifier (e.g. `struct __make_unsigned`) was seen again
- in a token that was lexed and cached before the first occurrence was parsed.
- (#GH214128)
-- Fixed a crash when a coroutine keyword appeared inside a mem-initializer on a
- function that is not a constructor. (#GH194298)
-
-- Fixed an assertion when a defaulted comparison operator was synthesized for a
- class with an invalid non-static data member, such as one qualified with an
- address space. (#GH194605)
-
-- Fixed deduction of the template parameters appearing in the type of a
- constant template parameter of reference type. (#GH40328)
-
-- Fixed an issue where an explicit specialization of a constexpr variable would
- result in a link error. (#GH219796)
-
-- Fixed ambiguous overload where two non-static member functions with
- different signatures could be incorrectly considered equivalent. (#GH224499)
-
-- Fixed an assertion failure when explicitly instantiating a nested member with
- an ill-formed template argument. Clang now checks for a failed declaration
- lookup before asserting that the name is not dependent, avoiding an assertion
- after an earlier diagnostic has caused the declaration to be unavailable. (#GH220525)
-
-- Fixed a crash in constant evaluation when a new-expression selects a
- user-declared allocation function that takes std::nothrow_t by value. Such
- a new-expression is now correctly rejected in a constant expression because
- it does not select a replaceable global allocation function. (#GH212211)
-
-- Fixed `__attribute__((used))` and `-fkeep-inline-functions` being
- incorrectly ignored for complete constructors and destructors (C1/D1 variants)
- when `-mconstructor-aliases` is active. C1/D1 variants were previously
- replaced with their base variants (C2/D2) in the IR before retention could
- take effect, causing them to be dropped from llvm.used and omitted from
- the object file. (#GH226572)
-
-- Fixed an assertion failure when the initializer of a variable template
- specialization with a deduced type is instantiated from inside a lambda in
- the initializer of another specialization of the same variable template.
- (#GH134148)
-
#### Bug Fixes to AST Handling
- Fixed a non-deterministic ordering of unused local typedefs that made
@@ -819,9 +570,6 @@ features cannot lower the translation-unit ABI level;
- `FunctionDecl::getReturnTypeSourceRange()` now returns correct source
location of a trailing return type. (#GH162649)
-- Added missed information to the AST node representing the member function
- when calling a explicit object member function. (#GH218829)
-
#### Miscellaneous Bug Fixes
#### Miscellaneous Clang Crashes Fixed
@@ -835,25 +583,6 @@ features cannot lower the translation-unit ABI level;
threshold to the target's `size_t` width instead of using a fixed
threshold of `1 << 60` regardless of the target.
- Fixed a crash when generating fake uses for parameters of bodyless destructors with `-fextend-variable-liveness`.
-- Fixed a crash when filling in the ``TypeLoc`` for an ``AttributedType``
- that was inherited from a different declarator, for example when
- ``__typeof__`` resolves to the type of another, already-processed
- declaration. (#GH217489)
-- Fixed a crash when the constant evaluator default-constructed or copied a
- very large array, such as a local ``T s[0xFFFFFFFF][0]`` of an empty class
- ``T``. Such evaluations now fail once the element count exceeds the
- ``-fconstexpr-steps`` limit, as they already did for ``new``. (#GH173728)
-- Fixed an assertion failure when instantiating a block that captures
- `this` via a member access through a dependent base class.
-- Fixed `DiagnoseUnguardedAvailability::TraverseIfStmt` dereferencing a nullptr
- on `if consteval {}`. (#GH220004)
-- Fixed an assertion when the `dim` argument to an OpenACC `gang` clause
- evaluated to a value not representable by a signed integer, such as an
- unsigned wrap around. (#GH221418)
-- Fixed an assertion failure when a method or function definition follows an
- Objective-C `@implementation` that was ended by a nested `@interface`,
- `@protocol` or `@implementation` before its `@end`. (#GH209503)
-- Fixed use-after-free with annotate attribute on a C++ class method with a this-adjusting thunk.
### OpenACC Specific Changes
@@ -877,17 +606,10 @@ features cannot lower the translation-unit ABI level;
- `__builtin_amdgcn_fcmp`
- `__builtin_amdgcn_fcmpf`
-#### DirectX Support
-
-- `clang-dxc` and HLSL support are now enabled by default, following the
- promotion of the DirectX backend to an official LLVM target.
-
#### NVPTX Support
#### X86 Support
-- Support `AVX10_V2_AUX` ISA (`-mavx10v2aux`).
-
#### Arm and AArch64 Support
- Added support for pointer authentication discrimination of C++ virtual table
@@ -900,16 +622,6 @@ features cannot lower the translation-unit ABI level;
#### Windows Support
-- Clang now accepts ``_except`` as an alias for ``__except`` in SEH handler
- position when ``-fms-compatibility`` is enabled, matching the existing
- ``_try``, ``_finally``, and ``_leave`` aliases. ``_except`` remains an ordinary
- identifier outside that context.
-
-- Fixed ``setjmp`` on 32-bit Arm passing the frame pointer, rather than the
- stack pointer as it was on entry to the function, as the frame value the CRT
- stores in the ``jmp_buf``. Clang now uses ``llvm.sponentry`` there, as it
- already did on AArch64.
-
- Fixed a bug where Clang did not match the MSVC ABI on Arm64 when an
over-aligned base class is followed by another base class. MSVC on Arm64 (but
not Arm64EC or x64) reuses the tail padding of the over-aligned base for the
@@ -918,11 +630,6 @@ features cannot lower the translation-unit ABI level;
#### LoongArch Support
-- `loongarch32-*-none-elf` and `loongarch64-*-none-elf` targets now use the
- bare-metal toolchain, like other bare-metal targets. The linker is run
- directly instead of through `gcc`, and host include directories are no
- longer searched.
-
#### RISC-V Support
- Fixed a bug where the `interrupt` attribute did not accept `machine` together
@@ -931,7 +638,8 @@ features cannot lower the translation-unit ABI level;
- Added a new warning when the same interrupt type is specified more than
once in a RISC-V `interrupt` attribute.
-- SiFive CLIC preemptible interrupt handlers now support frame pointers.
+- SiFive CLIC preemptible interrupt handlers now diagnose unsupported frame
+ pointers instead of producing a backend fatal error.
- Added `-march=native` for better compatibility with ARM, AArch64, and X86. This
option will be treated like `-mcpu=native` if `-mcpu` is not present. If
@@ -951,26 +659,12 @@ features cannot lower the translation-unit ABI level;
- Added `--cuda-emit-nvcc-abi` to emit the NVCC-compatible host registration ABI
(`__cudaRegisterLinkedBinary`).
-- Fixed CUDA built-in variables such as `threadIdx` and `blockDim` being incorrectly treated as having side effects in assumptions. (#GH181340)
-
-- Clang now provides device-side definitions of `__cxa_pure_virtual()` and
- `__cxa_deleted_virtual()`; previously, any (potential) call to a pure/deleted
- virtual function that could not be optimised out would cause the program to
- fail to assemble. This is now fixed. (#GH49183) (#GH67533)
-
#### AIX Support
#### NetBSD Support
#### WebAssembly Support
-- Added `__builtin_wasm_memory_copy` and `__builtin_wasm_memory_fill` builtins
- for the WebAssembly `memory.copy` and `memory.fill` bulk memory instructions.
-
-- Fixed a "function signature mismatch" trap at program exit when destroying a
- temporary that is bound to a reference with static or thread storage
- duration. (#GH45221)
-
#### AVR Support
#### SystemZ Support
@@ -990,8 +684,7 @@ features cannot lower the translation-unit ABI level;
- Add `AfterRequiresExpression` sub-option of `BraceWrapping` to wrap the
body of requires expressions. It is enabled by the `Allman`, `Whitesmiths`,
and `GNU` styles of `BreakBeforeBraces`.
-- Add `AtEndOfBlock` sub-option of `KeepEmptyLines` to control the number of
- empty lines kept at end of blocks.
+
- `QualifierOrder` now supports `typedef`, `consteval`, `constinit`,
`thread_local`, `extern`, `mutable`, `signed`, `unsigned`, `long`, `short`,
and `explicit` declaration specifiers.
@@ -999,18 +692,9 @@ features cannot lower the translation-unit ABI level;
### libclang
- visit identifier initializers in lambda capture as VarDecl instead of VariableRef. Warning: this changes behaviour.
-- add unary operator handling to `clang_getCursorSpelling()`.
### Code Completion
-- Parameters declared with a `decltype` are now presented as the type the
- `decltype` resolves to, e.g. `set_x(int val)` rather than
- `set_x(decltype(x) val)`. This affects the completion strings produced by
- libclang as well as those used by clangd.
-
-- Members inherited from a dependent base class that is named through an alias
- template are suggested by code completion when relevant.
-
### Static Analyzer
#### Crash and bug fixes
@@ -1043,33 +727,8 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use
### Python Binding Changes
-- Fixed a crash (`SIGFPE`) when traversing an AST via the visitor callbacks
- (e.g. `Cursor.get_children`) on s390x. The callbacks now return a full
- register word so the return value is correctly extended, working around a
- `ctypes` bug (https://github.com/python/cpython/issues/156933) that left the
- high bytes of the return register uninitialized.
-- Add support for retrieving unary operator information through `Cursor.unary_operator()`.
-
### OpenMP Support
-- Fixed an OpenMP `requires` directive read from a PCH or module losing its effect on
- semantic checks, which caused spurious `reverse_offload` errors.
-- Added the OpenMP 6.1 `#pragma omp flatten` loop transformation and the
- `depth` clause. Flatten combines perfectly nested canonical loops into one
- loop. `depth(k)` selects how many outermost loops to combine (default 2).
-- Canonicalize intra-tiles in loop tiling. `#pragma omp tile` still emits a
- min-bounded inner loop, which vectorizes well. When a parent directive such as
- `for collapse(n)` needs a constant per-tile trip count, Clang rereads a
- droppable hint and treats that inner loop as rectangular, with an overshoot
- guard only if the last tile can be partial.
-
- Not yet supported (diagnosed, left as follow-up):
-
- - `collapse` through stacked `#pragma omp tile` (the inner floor is not a
- collapsed counter).
- - A loop transformation (`tile`, `unroll`, `interchange`, ...) that consumes
- another tile's intra-tile loop.
-
- Added parsing and semantic support for `dims` modifier in `num_teams`,
`thread_limit` and `num_threads` clauses for OpenMP 6.1 or later.
- Map-type-modifying modifiers applied to a list item with a user-defined mapper
@@ -1077,26 +736,6 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use
- Mapping of expressions with base-pointers through a user-defined mapper (e.g.
`map(s.p[0:n])`) now conforms to OpenMP's conditional pointer-attachment,
matching the behavior of such maps outside a mapper.
-- The `holds` clause on the `assume` directive now lowers side-effect-free
- conditions to `llvm.assume`, enabling downstream optimizations. Previously
- the clause was parsed but its condition was discarded without effect.
-- Fixed a crash when the loop variable or a loop bound of an OpenMP loop has a
- `_BitInt` type wider than any standard integer type. (#GH140074)
-
-- Added support for capturing structured bindings in OpenMP regions
- (a C++20 extension; warned as an extension in C++17). Individual bindings
- form aggregate decompositions(structs, classes, and arrays) can now be used
- in data-sharing clauses (``private``, ``firstprivate``, ``lastprivate``,
- ``shared``, ``linear``) and ``map`` clauses for target directives.
- Tuple-like bindings (types using the tuple protocol with ``get<N>()``,
- such as ``std::pair`` or ``std::tuple``) are not yet supported and
- will produce a compilation error. Reduction clauses with structured bindings
- are not yet supported.
- When the original variable is explicitly mapped in a target region
- but only bindings from it are used (not the original variable itself),
- modifications to the bindings will not be reflected in the original variable.
- To ensure correct behavior, either use the original variable directly in the
- target region or map the bindings explicitly instead.
### SYCL Support
diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td
index c6c73afb698f9e0..95bcac1b010c632 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -8660,7 +8660,7 @@ def ast_dump_filter_EQ : Joined<["-"], "ast-dump-filter=">,
Alias<ast_dump_filter>;
def ast_dump_filter_path : Separate<["-"], "ast-dump-filter-path">,
MetaVarName<"<path_filter>">,
- HelpText<"Use with -ast-dump or -ast-print to dump/print only AST declaration"
+ HelpText<"Use with '-ast-dump' or '-ast-print' to dump/print only AST declaration"
" nodes whose source file path matches a glob pattern.">,
MarshallingInfoString<FrontendOpts<"ASTDumpFilterPath">>;
def ast_dump_filter_path_EQ : Joined<["-"], "ast-dump-filter-path=">,
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp
index e7f4e00c2c5b79a..cf01056f8ffaca3 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -96,17 +96,22 @@ namespace {
if (!FilterPath.empty()) {
const SourceManager &SM = D->getASTContext().getSourceManager();
- SourceLocation Loc = SM.getSpellingLoc(D->getLocation());
+ SourceLocation Loc = D->getLocation();
if (Loc.isInvalid())
return false;
- auto Pattern = llvm::GlobPattern::create(FilterPath);
+ PresumedLoc PLoc = SM.getPresumedLoc(Loc);
+ if (PLoc.isInvalid())
+ return false;
+
+ llvm::Expected<llvm::GlobPattern> Pattern =
+ llvm::GlobPattern::create(FilterPath);
if (!Pattern) {
llvm::consumeError(Pattern.takeError());
return false;
}
- if (!Pattern->match(SM.getFilename(Loc)))
+ if (!Pattern->match(PLoc.getFilename()))
return false;
}
diff --git a/clang/test/AST/ast-dump-filter-path-include.c b/clang/test/AST/ast-dump-filter-path-include.c
new file mode 100644
index 000000000000000..97a82302285d7cc
--- /dev/null
+++ b/clang/test/AST/ast-dump-filter-path-include.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -ast-dump -ast-dump-filter-path %s %s | FileCheck %s
+
+#include "filter-header.h"
+
+MAKE_VAR(z)
+
+// CHECK: VarDecl {{.*}} z
diff --git a/clang/test/AST/ast-dump-filter-path.c b/clang/test/AST/ast-dump-filter-path.c
new file mode 100644
index 000000000000000..d24eeea52d3b170
--- /dev/null
+++ b/clang/test/AST/ast-dump-filter-path.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ast-dump -ast-dump-filter-path "*ast-dump-filter-path.c" %s | FileCheck %s
+
+int x;
+// CHECK: VarDecl {{.*}} x
+
+#define MAKE_VAR(name) int name;
+MAKE_VAR(y)
+// CHECK: VarDecl {{.*}} y
\ No newline at end of file
diff --git a/clang/test/AST/filter-header.h b/clang/test/AST/filter-header.h
new file mode 100644
index 000000000000000..8b54743ed869220
--- /dev/null
+++ b/clang/test/AST/filter-header.h
@@ -0,0 +1 @@
+#define MAKE_VAR(name) int name;
>From 00769f2653ec64f706e3c5d65ddcf2c4d6d7ed3a Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Mon, 31 Aug 2026 01:38:34 -0400
Subject: [PATCH 3/5] [clang] Make ast-dump-filter-path include test portable
---
clang/test/AST/ast-dump-filter-path-include.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/AST/ast-dump-filter-path-include.c b/clang/test/AST/ast-dump-filter-path-include.c
index 97a82302285d7cc..9394c153cc8e7a3 100644
--- a/clang/test/AST/ast-dump-filter-path-include.c
+++ b/clang/test/AST/ast-dump-filter-path-include.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -ast-dump -ast-dump-filter-path %s %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ast-dump -ast-dump-filter-path "*ast-dump-filter-path-include.c" %s | FileCheck %s
#include "filter-header.h"
MAKE_VAR(z)
-// CHECK: VarDecl {{.*}} z
+// CHECK: VarDecl {{.*}} z
\ No newline at end of file
>From fe4f0bfa6db38a39335b448204299ed0d20b3f12 Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Fri, 2 Oct 2026 20:49:10 -0400
Subject: [PATCH 4/5] [clang] Address AST dump filter review comments
---
clang/test/AST/ast-dump-filter-path-include.c | 2 +-
clang/test/AST/ast-dump-filter-path.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/AST/ast-dump-filter-path-include.c b/clang/test/AST/ast-dump-filter-path-include.c
index 9394c153cc8e7a3..efb5901911803c7 100644
--- a/clang/test/AST/ast-dump-filter-path-include.c
+++ b/clang/test/AST/ast-dump-filter-path-include.c
@@ -4,4 +4,4 @@
MAKE_VAR(z)
-// CHECK: VarDecl {{.*}} z
\ No newline at end of file
+// CHECK: VarDecl {{.*}} z
diff --git a/clang/test/AST/ast-dump-filter-path.c b/clang/test/AST/ast-dump-filter-path.c
index d24eeea52d3b170..7867f6a2503cc34 100644
--- a/clang/test/AST/ast-dump-filter-path.c
+++ b/clang/test/AST/ast-dump-filter-path.c
@@ -5,4 +5,4 @@ int x;
#define MAKE_VAR(name) int name;
MAKE_VAR(y)
-// CHECK: VarDecl {{.*}} y
\ No newline at end of file
+// CHECK: VarDecl {{.*}} y
>From 14bb66443eb35c3bea8235c4d92bab2b3987c0bb Mon Sep 17 00:00:00 2001
From: inconnu08 <taufiqrx8 at gmail.com>
Date: Fri, 2 Oct 2026 21:33:09 -0400
Subject: [PATCH 5/5] [clang] Fix AST dump filter formatting and release notes
---
clang/docs/ReleaseNotes.md | 386 +++++++++++++++++++++++++++-
clang/lib/Frontend/ASTConsumers.cpp | 25 +-
2 files changed, 389 insertions(+), 22 deletions(-)
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 007e1f8131ab9f2..bc379f761c7313e 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -12,10 +12,6 @@ myst:
{#clang-release-releasenotestitle}
# Clang {{ (('(In-Progress) ' if env.app.tags.has('PreRelease') else '') ~ 'Release Notes') if env.config.project == 'Clang' else '|ReleaseNotesTitle|' }}
-```{contents}
-:depth: 2
-:local:
-```
Written by the [LLVM Team](https://llvm.org/)
@@ -54,6 +50,11 @@ in a future version of Clang.
### C++ Specific Potentially Breaking Changes
+- The `[[carries_dependency]]` attribute is no longer recognized, in any language
+ mode, as it was removed from the standard by
+ [P3475R2](https://wg21.link/P3475R2).
+
+
### Objective-C Specific Potentially Breaking Changes
- Fixed an issue where AST consumers based on `RecursiveASTVisitor` would bypass
@@ -73,7 +74,7 @@ features cannot lower the translation-unit ABI level;
- On SPARC, a `_Complex` value with an integer element type is now passed and
returned packed into the one or two integer registers it fits in, matching GCC.
Clang previously passed such a value indirectly and returned it with one part
- per register.
+ per register.
`-fclang-abi-compat=23` restores the previous behavior. (#GH212340)
- On SPARC64, a `_Complex char` or `_Complex short` is now
@@ -96,12 +97,31 @@ features cannot lower the translation-unit ABI level;
- On MIPS N32/N64, an `__int128` now correctly start in an even-numbered register
or 16-byte aligned stack slot, matching GCC.
+- Except on PlayStation, on x86-64 System V a non-zero-width unnamed bit-field
+ now classifies the eightbytes it occupies as INTEGER, like a named bit-field,
+ matching GCC. Aggregates where this changes the classification may be passed
+ or returned differently -- a struct holding a run of `__int128` bit-fields,
+ for example, now travels in the two integer registers the ABI assigns it.
+ This also fixes a crash when such a struct was passed or returned.
+ `-fclang-abi-compat=23` restores the previous behavior. (#GH202205)
+
+- Clang now considers matrix types in its isHomogeneousAggregate() handling,
+ which can lead to differences in how structures containing matrix types are
+ classified for ABI purposes. The previous exclusion of matrix types appears
+ to have been accidental. Matrix types now follow the same rules as arrays
+ for homogeneous aggregate classification.
+ `-fclang-abi-compat=23` restores the previous behavior. (#GH218799)
+
### AST Dumping Potentially Breaking Changes
### Clang Frontend Potentially Breaking Changes
- Templight support has been removed.
+- `-fstack-clash-protection` has been enabled implicitly by default for android
+ target triples (except 32b arm targets). Can be disabled via
+ `-fno-stack-clash-protection`.
+
### Clang Python Bindings Potentially Breaking Changes
- `CompletionChunkKind` instance's `__str__` representation has been adapted to be consistent with other enums in the library.
@@ -119,7 +139,9 @@ features cannot lower the translation-unit ABI level;
- `CompletionString.availability` now returns instances of `AvailabilityKind`.
As a result, the `__str__` representation of its return values changed.
- Like other libclang enums, it now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`.
+ Like other libclang enums, it now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`.
+
+- `Cursor` instance's `enum_value` method now returns 1 instead of -1 for `true` bool enumeration values
### OpenCL Potentially Breaking Changes
@@ -150,10 +172,17 @@ features cannot lower the translation-unit ABI level;
- Clang now supports [P3533R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3533r2.html) (constexpr virtual inheritance).
+- Implemented the language part of [P3475R2](https://wg21.link/P3475R2) (Defang
+ and deprecate `memory_order::consume`) by removing support for the
+ `[[carries_dependency]]` attribute.
+
#### C++23 Feature Support
#### C++20 Feature Support
+- Now clang-scan-deps in P1689 format can find the dependencies described in
+ module map file. See the documents of standard C++ modules for details.
+
#### C++17 Feature Support
#### Resolutions to C++ Defect Reports
@@ -161,6 +190,10 @@ features cannot lower the translation-unit ABI level;
- Clang now falls back to alignment-aware allocation functions for
non-overaligned types, implementing [CWG2282](https://wg21.link/cwg2282).
+- Clang now converts floating-point values to boolean first when converting
+ them to an enumeration type with a fixed `bool` underlying type. This
+ resolves [CWG1094](https://wg21.link/cwg1094).
+
### C Language Changes
#### C2y Feature Support
@@ -205,9 +238,18 @@ features cannot lower the translation-unit ABI level;
- Clang tools now resolve tool names without a path in compilation databases
through `PATH`.
+- On musl targets, the driver now links ``libssp_nonshared.a`` when stack
+ protection is enabled and the library is present in the toolchain library
+ paths, matching what musl distributions configure GCC to do.
+
- Clang now allows GNU computed `goto` extension in `constexpr` functions, matching the relaxed
`constexpr` function body rules introduced in C++23.
+- Added support for the `__builtin_strlcat` and `__builtin_strlcpy` builtins.
+
+- Added `__builtin_sort_pack` to sort a pack of types using the same
+ order as `__builtin_type_order`.
+
### New Compiler Flags
- New option `-fdefined-pointer-subtraction` added to preserve stable semantics
@@ -245,14 +287,37 @@ features cannot lower the translation-unit ABI level;
- All options of the `-fzero-call-used-regs` compiler flag are now allowed on RISC-V.
+- `-ftrivial-auto-var-init=` now initializes variables whose declaration is
+ bypassed by a `goto` or `switch`, which were previously left uninitialized.
+ The initialization is emitted at each bypassing jump. See the
+ `-ftrivial-auto-var-init=` entry in the User's Manual for the details,
+ including where C deliberately departs from C 6.2.4p6.
+
### Removed Compiler Flags
### Attribute Changes in Clang
- Clang now properly propagates attributes on class and variable templates to their redeclarations, which will result in redeclarations not interfering with diagnostics. (#GH209812)
+- Clang now recognizes the `[[gnu::flag_enum]]` attribute and treats it equivalent to `[[clang::flag_enum]]`
+
+- Clang now accepts `_single_inheritance` under `-fms-compatibility` as an alias for `__single_inheritance`; `_multiple_inheritance` and `_virtual_inheritance` were already correctly supported as aliases.
+
### Improvements to Clang's diagnostics
+- `-Wfortify-source` now diagnoses when `strlcat`, `__builtin_strlcat`, `strlcpy`, or
+ `__builtin_strlcpy` is called with a size argument larger than the destination buffer.
+
+- `-Wfortify-source` now diagnoses when `recv` or `recvfrom` is called with a
+ size argument larger than the destination buffer.
+
+- `-Wfortify-source` now diagnoses when `poll`, `ppoll`, or `ppoll64` is called
+ with a descriptor count whose total size exceeds the `fds` array size.
+
+- The `cannot overload a member function` diagnostic now describes the previous
+ declaration first, matching the order in which the declarations appear in the
+ source. (#GH219803)
+
- More consistent rendering of Unicode characters in diagnostic messages.
- Fixed `-Wunused-parameter` to diagnose coroutine parameters that are only
@@ -260,9 +325,20 @@ features cannot lower the translation-unit ABI level;
initialization, while not diagnosing parameters passed to the selected
allocation function or promise constructor. (#GH217501)
+- The `wb` and `uwb` `_BitInt` literal suffixes are no longer diagnosed by default
+ before C23. They stay in `-Wc23-extensions` and are still reported under
+ `-pedantic` or when that group is enabled explicitly, matching how the `_BitInt`
+ type itself is already handled.
+
- Fixed bug in `-Wdocumentation` so that it correctly handles explicit
function template instantiations (#64087).
+- When a `constexpr` range-based for loop variable cannot be initialized by a
+ constant expression, Clang now emits a single note identifying the read of
+ the loop's implicit `__begin` variable, instead of a generic note about
+ reading a non-constexpr variable followed by a `declared here` note.
+ (#GH211926)
+
- Fixed concept template parameters not being recognized in `-Wdocumentation`
when mentioned in tparam comments. (#GH64087)
@@ -330,6 +406,9 @@ features cannot lower the translation-unit ABI level;
};
```
+- Lifetime safety analysis is now enabled for C by default. The `-fexperimental-lifetime-safety-c`
+ flag is renamed to `-flifetime-safety-c`. Use `-fno-lifetime-safety-c` to disable it.
+
- Improved `-Wassign-enum` performance by caching enum enumerator values. (#GH176454)
- Fixed a false negative in `-Warray-bounds` where the warning was suppressed
@@ -408,6 +487,9 @@ features cannot lower the translation-unit ABI level;
- Diagnostics for the C++11 range-based for statement now report the correct
iterator type in notes for invalid iterator types.
+- `-Wfortify-source` now diagnoses calls to `fread`, `fwrite`, and `fgets`
+ when the requested size exceeds the corresponding buffer. (#GH204337)
+
- `-Wfortify-source` now warns when the constant-evaluated argument to
`umask` has bits set outside `0777`. Those bits are silently discarded
by the kernel, so setting them is almost always a typo (matching the
@@ -433,8 +515,42 @@ features cannot lower the translation-unit ABI level;
- `-Wc++98-compat` now diagnoses explicit conversion functions in C++20 and
later, matching the behavior in C++11 through C++17. (#GH161689)
+- Added `-Wcounter-extension` as a diagnostic group under `-Wc2y-extensions` to
+ control `__COUNTER__` being diagnosed as an extension. This allows `-pedantic`
+ users to disable the diagnostic with `-Wno-counter-extension` without having
+ to disable all pedantic diagnostics. (#GH196557)
+
- Clang now diagnoses more details when a constraint evaluates to false.
+- `-Wpointer-arith` no longer reports subtraction of pointers to a variably
+ modified type, such as `int[n]`, as a subtraction of pointers to a type of
+ zero size, unless the size is provably zero: a zero-sized base element or a
+ dimension that is a zero integer constant, as in `struct Empty vla[n]` or
+ `int vla[n][0]`. (#GH28328)
+
+- Fixed a missing `-Wconstant-conversion` diagnostic for signed `char` arrays.
+
+- Clang now diagnoses passing wrong vector type as a mask to `__builtin_shufflevector`. (#GH218132)
+
+- `-Wdelete-abstract-non-virtual-dtor` and `-Wdelete-non-abstract-non-virtual-dtor`
+ no longer warn when the selected deallocation function is a destroying
+ `operator delete`, since such a delete expression never invokes the
+ destructor. (#GH65524)
+
+- Fixed a false-positive `-Wshadow` warning when a variable in an
+ inline-defined friend function shares the name of a non-static class
+ member variable. (#GH221190)
+
+- Clang now diagnoses matrix logical operations are only supported for HLSL. (#GH222381)
+
+- Improve the input size mismatch diagnostic when calling `__builtin_shufflevector` with valid
+ vector element types but different sizes. (#GH221791)
+
+- Suggests the correct location for an attribute written before the `using`
+ keyword of an alias-declaration. (#GH155787)
+
+- Improve Clang diagnoses when unary `__imag` operator with non-complex type operand is used as lvalue. (#GH222383)
+
### Improvements to Clang's time-trace
### Improvements to Coverage Mapping
@@ -442,6 +558,7 @@ features cannot lower the translation-unit ABI level;
### Bug Fixes in This Version
- Fixed incorrect handling of C++ import preprocessing token when a digraph character after import. (#GH190693)
+- Fixed a crash when emitting RTTI for a `dllexport` class, or the fundamental type descriptors for `__cxxabiv1::__fundamental_type_info`, under `-fvisibility=hidden`. (#GH207963)
- Fixed an assertion failure when passing a wide string literal to `__builtin_nan`. (#GH212108)
- Fixed a constraint comparison bug in partial ordering. (#GH182671)
- Fixed a rejected-valid case that used an explicit object parameter in an out-of-line definition of a nested class member. (#GH136472)
@@ -450,7 +567,9 @@ features cannot lower the translation-unit ABI level;
- Fixed USR generation for declarations whose signature mentions a class-type
non-type template parameter. (#GH212351)
- Fixed an assertion caused by Microsoft integer literals exceeding the maximum value. (#GH212504)
+- Fixed an assertion failure when a value of a Unicode character type (`char8_t`, `char16_t`, `char32_t`) was implicitly splatted to a vector of the same element type, e.g. when comparing an `ext_vector_type` of `char32_t` with one of its elements. (#GH202317)
- Fixed a crash when checking scalar type with excess braces. (#GH69213), (#GH137845), (#GH198767), (#GH207566), (#GH106180)
+- Fixed an assertion failure when a global variable in a non-default address space, such as one declared with `__seg_gs`, is mapped into an OpenMP `target` region. (#GH140069)
- Fixed an assertion crash when instantiating a nested requirement with an invalid constraint. (#GH213575)
- Clang now defines the GCC-compatible predefined macro `__SIG_ATOMIC_TYPE__`. (#GH213895)
- Fixed IEEE f128 complex mul/div using the IBM f128 libcalls on powerpc. (#GH216820)
@@ -458,20 +577,46 @@ features cannot lower the translation-unit ABI level;
- Fixed a bug where a stray closing curley brace in an OpenMP/OpenACC pragma could cause pragma parsing issues when inside of a member function. (#GH214195)
- Fixed a bug where preprocessor directives following comments were not correctly recognized when using -C. (#GH48361)
- Fixed a crash when declaring a member template within a local class inside an OpenMP region. (#GH216052)
+- Fixed an assertion failure when a variable implicitly mapped by an OpenMP `target` directive has a class type
+ (such as `std::map`) whose mapper lookup instantiates a class template specialization. (#GH154704)
- Fixed a bug where repeated #imports of modular headers in non-modular compilation were translated to #pragma clang module import. (#GH216924)
- Fixed an assertion when `#pragma omp declare simd` or `#pragma omp declare variant` is followed by another OpenMP declarative directive containing a qualified identifier. (#GH217204)
-
+- Fixed crashes on an OpenMP `target` region inside a lambda or block at namespace scope, including when the region used a global reference. (#GH223397)
+- Fixed a crash when an `asm` label names the register for a global variable of incomplete type. (#GH219746)
+- Fixed an ICE hat occurred when using `__imag int/float` as lvalue in assignment. (#GH119498)
+- Fixed an assertion failure in `-Wsign-compare` when a negated or complemented vector of unsigned integers was compared against a signed constant. (#GH203575)
+- Fixed an assertion failure when a constant statement expression that declares a variable is used as a bound of an OpenMP loop. A statement expression in a bound of a non-rectangular loop is now diagnosed. (#GH153987)
+- Fixed a bug where a bit-field accessed as the result of a statement expression
+ (e.g. `({ s.b; })`) was not subject to integer promotion, unlike an ordinary
+ bit-field access. (#GH221542)
+- No longer crashing due to follow-on diagnostics when there is an invalid operand in a logical operator involving a vector operand. (#GH227588)
+- Fixed assertion failures caused by stale linkage information when an extern variable or function declaration is merged with a preceding static declaration. (#GH204759, #GH204754)
+- Fixed a crash due to typo correction mishandling custom keywords `_virtual_inheritance` and `_multiple_inheritance` in `-fms-compatibility` mode. (#GH228003)
+
#### Bug Fixes to Compiler Builtins
- Fixed a crash when classifying a call to a builtin with dependent arguments,
such as when the call is used as an `auto` non-type template argument.
+- Fixed an assertion failure when diagnosing a constant evaluation failure
+ inside a member function call synthesized by ``__builtin_invoke``. (#GH185241)
- Fixed a crash in ``__builtin_dump_struct`` when ``-Werror`` promotes
format warnings to errors. (#GH211943)
+- Fixed wrong code generation in `__builtin_clear_padding` wherein the wrong
+ bits of the following types were cleared: `_BitInt`, struct bitfields, and
+ packed boolean vectors. (#GH215809), (#GH216063), (#GH224033)
+- Fixed an assertion failure when `__builtin_vectorelements` is applied to a
+ reference to a vector type; `vec_step` (in C++ for OpenCL) and
+ `__builtin_ptrauth_type_discriminator` similarly no longer accept reference
+ types that their evaluation silently mishandled. (#GH216997)
#### Bug Fixes to Attribute Support
- Fixed crash (assertion) when the `alloc_align` attribute was applied to a declaration whose type has a `FunctionProtoType` but which is not itself a `FunctionDecl`, such as a function-pointer variable. (#GH122058)
+- Fixed a crash on `bool` vectors declared with `ext_vector_type` and more than
+ 2^23 elements; `ext_vector_type` and `vector_size` now both reject vectors
+ with more than 2^23 elements or larger than 2^28 bytes. (#GH165458)
+
- The `counted_by`/`counted_by_or_null` diagnostic that rejects a pointer whose
pointee is a struct with a flexible array member (e.g.
``struct with_fam * __sized_by(size) ptr;``) was incorrectly also applied to
@@ -485,15 +630,41 @@ features cannot lower the translation-unit ABI level;
#### Bug Fixes to C++ Support
+- Fixed lambdas with specifiers or attributes after the capture list being
+ misparsed as function declarations in direct-initialization contexts under
+ `-fms-extensions` or in HLSL mode.
+
+- Fixed the destruction timing of temporaries created by default member
+ initializers during aggregate initialization. Such an initializer is part of
+ the full-expression containing the aggregate initialization. (#GH85601)
+
+- Fixed false-positive module ODR diagnostics when a type is found through a
+ using-declaration in one definition and directly in another. ODR hashing also
+ now distinguishes differently qualified uses of types found through
+ using-declarations. (#GH78850)
+- Fixed an assertion when diagnosing module ODR violations for enum underlying
+ types found through using-declarations with the same name but different types.
+
+- Fixed a false type mismatch when a typedef naming an anonymous enumeration
+ was used through a C++20 named module and its defining header was subsequently
+ included. (#GH213299)
+
- Fixed an issue where `__typeof__` incorrectly rejected cv-qualified function types.
+- Fixed an assertion failure when `#embed` was used in the braced initializer
+ of an array new-expression, or of an array whose elements are of class type.
+ (#GH128985)
+
- Fixed a bug where top-level CV qualifiers (such as ``const``) were dropped from pointers modified by Microsoft pointer attributes (like ``__ptr32`` and ``__ptr64``) and WebAssembly's ``__funcref``.
+- Fixed a bug where we accepted ``__super`` being qualified by a scope specifier, causing codegen to assertion fail elsewhere. (#GH212988)
- Fixed an issue where we tried to compare invalid NTTPs for variable declarations, which ended up in hitting an assertion with a constrained non-plain-auto NTTP, which we don't quite implement yet. (#GH208658)
- Fixed a crash when a using-declaration naming an unresolvable member of a
dependent base was shadowed by an invalid using-declaration. (#GH209427)
+- Fixed a CTAD bug when combining with concepts. (#GH124715)
+
- Fixed a regression where an internal-linkage function (e.g. a `static` or
anonymous-namespace helper) declared in the global module fragment of the
current translation unit was removed from the overload set when the calling
@@ -504,6 +675,9 @@ features cannot lower the translation-unit ABI level;
- Fixed a crash when module directive export module foo not following a
semicolon and there are no rest pp-tokens in current module file. (#GH187771)
+- Fixed concept evaluation bugs where some declarations were not added to
+ the current instantiation scope. (#GH198052)
+
- Fixed a crash when a lambda parameter pack was given a default argument that
is a pack expansion referencing an enclosing function's parameter pack (e.g.
`[](Types... = args...) {}`). Clang now diagnoses the illegal default
@@ -521,6 +695,11 @@ features cannot lower the translation-unit ABI level;
operator required an access check that ran while an enclosing declaration
was still being parsed. (#GH210692)
+- Fixed an assertion when a call to a class object was resolved through a
+ conversion function to a function pointer that was introduced into the class
+ by a using-declaration (e.g. `using Base::operator auto;`). Such a conversion
+ function is now also diagnosed if it is deleted. (#GH189146)
+
- A workaround that was introduced to fix an issue with the `<format>` header present in some versions of
libstdc++15 has been extended to support preprocessed input. Previously, splitting the preprocessing and
compilation step would result in the fix not being applied. (#GH160314)
@@ -535,6 +714,16 @@ features cannot lower the translation-unit ABI level;
affect C++26 constexpr structured bindings and expansion statements, but
also affects some uses of plain structured bindings. (#GH211930)
+- Fixed an assertion when instantiating the body of a C++26 expansion
+ statement after a fatal error had occurred. (#GH214917)
+
+- Fixed an assertion when an invalid statement appeared in a ``switch``
+ statement nested inside a C++26 expansion statement. (#GH210575)
+
+- Fixed an assertion when a ``matrix_type`` with constant dimensions and a
+ dependent element type was instantiated with an invalid element type.
+ (#GH202744)
+
- Fixed friend declarations sometimes making non-visible default arguments
incorrectly visible to default argument redefinition checks across modules.
@@ -543,6 +732,13 @@ features cannot lower the translation-unit ABI level;
using ``__is_constructible`` on a nested class template inside the definition
of the containing class. (#GH215166)
+- Fixed a crash issue when a value dependent recovery init appeared in constant
+ evaluation context in default constant evaluator.
+
+- Fixed a bug where Clang incorrectly required `promise.return_value()` for a
+ dependent `co_return` operand that inits to `void`, instead of using
+ `promise.return_void()`. (#GH218368)
+
- Fixed merging of lambdas across modules in the case where neither lambda is
imported from an AST file. (#GH214560)
@@ -550,17 +746,75 @@ features cannot lower the translation-unit ABI level;
to a subobject and is used in a context that requires an implicit conversion.
(#GH215900)
+- Fixed an assertion when mangling an abbreviated function template whose
+ return type has an ABI tag. (#GH204178)
+
- Fixed an assertion during template argument deduction where a function parameter pack is referenced by other types in the function type. (#GH28877), (#GH213760)
+- Fixed a regression where deprecation warnings were omitted for synthesized
+ deduction guide. (#GH160543)
+
- Fixed an assertion when a redeclaration of a function template or an out-of-line
definition of a member of a class template added a default argument to a
parameter that follows a parameter pack (e.g.
`template <typename... T> S::S(T..., int = 10) {}`). (#GH216211)
+- Fixed an assertion failure when instantiating a late-parsed function template defined in an earlier translation unit with -fdelayed-template-parsing. (#GH217073)
+
+- Allow redeclaration lookup to consider conversion function templates, allowing
+ Clang to match an in-class specialization such as `template<> operator int()`
+ against a prior conversion function template `template<class T> operator T()`.
+ (#GH218261)
- Fixed an assertion when an ill-formed qualified member function definition
inside a union caused the union to be treated as a polymorphic class.
(#GH213854)
+- Fixed a crash, a miscompile and a rejected-valid case when instantiating a
+ constructor whose mem-initializer used parenthesized aggregate initialization,
+ e.g. ``: agg({1, 2})`` or ``: arr(1, 2)``. (#GH176161, #GH189005, #GH213284)
+
+- Fixed an assertion when a type-trait keyword that had already been made
+ available as an identifier (e.g. `struct __make_unsigned`) was seen again
+ in a token that was lexed and cached before the first occurrence was parsed.
+ (#GH214128)
+- Fixed a crash when a coroutine keyword appeared inside a mem-initializer on a
+ function that is not a constructor. (#GH194298)
+
+- Fixed an assertion when a defaulted comparison operator was synthesized for a
+ class with an invalid non-static data member, such as one qualified with an
+ address space. (#GH194605)
+
+- Fixed deduction of the template parameters appearing in the type of a
+ constant template parameter of reference type. (#GH40328)
+
+- Fixed an issue where an explicit specialization of a constexpr variable would
+ result in a link error. (#GH219796)
+
+- Fixed ambiguous overload where two non-static member functions with
+ different signatures could be incorrectly considered equivalent. (#GH224499)
+
+- Fixed an assertion failure when explicitly instantiating a nested member with
+ an ill-formed template argument. Clang now checks for a failed declaration
+ lookup before asserting that the name is not dependent, avoiding an assertion
+ after an earlier diagnostic has caused the declaration to be unavailable. (#GH220525)
+
+- Fixed a crash in constant evaluation when a new-expression selects a
+ user-declared allocation function that takes std::nothrow_t by value. Such
+ a new-expression is now correctly rejected in a constant expression because
+ it does not select a replaceable global allocation function. (#GH212211)
+
+- Fixed `__attribute__((used))` and `-fkeep-inline-functions` being
+ incorrectly ignored for complete constructors and destructors (C1/D1 variants)
+ when `-mconstructor-aliases` is active. C1/D1 variants were previously
+ replaced with their base variants (C2/D2) in the IR before retention could
+ take effect, causing them to be dropped from llvm.used and omitted from
+ the object file. (#GH226572)
+
+- Fixed an assertion failure when the initializer of a variable template
+ specialization with a deduced type is instantiated from inside a lambda in
+ the initializer of another specialization of the same variable template.
+ (#GH134148)
+
#### Bug Fixes to AST Handling
- Fixed a non-deterministic ordering of unused local typedefs that made
@@ -570,6 +824,9 @@ features cannot lower the translation-unit ABI level;
- `FunctionDecl::getReturnTypeSourceRange()` now returns correct source
location of a trailing return type. (#GH162649)
+- Added missed information to the AST node representing the member function
+ when calling a explicit object member function. (#GH218829)
+
#### Miscellaneous Bug Fixes
#### Miscellaneous Clang Crashes Fixed
@@ -583,6 +840,25 @@ features cannot lower the translation-unit ABI level;
threshold to the target's `size_t` width instead of using a fixed
threshold of `1 << 60` regardless of the target.
- Fixed a crash when generating fake uses for parameters of bodyless destructors with `-fextend-variable-liveness`.
+- Fixed a crash when filling in the ``TypeLoc`` for an ``AttributedType``
+ that was inherited from a different declarator, for example when
+ ``__typeof__`` resolves to the type of another, already-processed
+ declaration. (#GH217489)
+- Fixed a crash when the constant evaluator default-constructed or copied a
+ very large array, such as a local ``T s[0xFFFFFFFF][0]`` of an empty class
+ ``T``. Such evaluations now fail once the element count exceeds the
+ ``-fconstexpr-steps`` limit, as they already did for ``new``. (#GH173728)
+- Fixed an assertion failure when instantiating a block that captures
+ `this` via a member access through a dependent base class.
+- Fixed `DiagnoseUnguardedAvailability::TraverseIfStmt` dereferencing a nullptr
+ on `if consteval {}`. (#GH220004)
+- Fixed an assertion when the `dim` argument to an OpenACC `gang` clause
+ evaluated to a value not representable by a signed integer, such as an
+ unsigned wrap around. (#GH221418)
+- Fixed an assertion failure when a method or function definition follows an
+ Objective-C `@implementation` that was ended by a nested `@interface`,
+ `@protocol` or `@implementation` before its `@end`. (#GH209503)
+- Fixed use-after-free with annotate attribute on a C++ class method with a this-adjusting thunk.
### OpenACC Specific Changes
@@ -606,10 +882,17 @@ features cannot lower the translation-unit ABI level;
- `__builtin_amdgcn_fcmp`
- `__builtin_amdgcn_fcmpf`
+#### DirectX Support
+
+- `clang-dxc` and HLSL support are now enabled by default, following the
+ promotion of the DirectX backend to an official LLVM target.
+
#### NVPTX Support
#### X86 Support
+- Support `AVX10_V2_AUX` ISA (`-mavx10v2aux`).
+
#### Arm and AArch64 Support
- Added support for pointer authentication discrimination of C++ virtual table
@@ -622,6 +905,16 @@ features cannot lower the translation-unit ABI level;
#### Windows Support
+- Clang now accepts ``_except`` as an alias for ``__except`` in SEH handler
+ position when ``-fms-compatibility`` is enabled, matching the existing
+ ``_try``, ``_finally``, and ``_leave`` aliases. ``_except`` remains an ordinary
+ identifier outside that context.
+
+- Fixed ``setjmp`` on 32-bit Arm passing the frame pointer, rather than the
+ stack pointer as it was on entry to the function, as the frame value the CRT
+ stores in the ``jmp_buf``. Clang now uses ``llvm.sponentry`` there, as it
+ already did on AArch64.
+
- Fixed a bug where Clang did not match the MSVC ABI on Arm64 when an
over-aligned base class is followed by another base class. MSVC on Arm64 (but
not Arm64EC or x64) reuses the tail padding of the over-aligned base for the
@@ -630,6 +923,11 @@ features cannot lower the translation-unit ABI level;
#### LoongArch Support
+- `loongarch32-*-none-elf` and `loongarch64-*-none-elf` targets now use the
+ bare-metal toolchain, like other bare-metal targets. The linker is run
+ directly instead of through `gcc`, and host include directories are no
+ longer searched.
+
#### RISC-V Support
- Fixed a bug where the `interrupt` attribute did not accept `machine` together
@@ -638,8 +936,7 @@ features cannot lower the translation-unit ABI level;
- Added a new warning when the same interrupt type is specified more than
once in a RISC-V `interrupt` attribute.
-- SiFive CLIC preemptible interrupt handlers now diagnose unsupported frame
- pointers instead of producing a backend fatal error.
+- SiFive CLIC preemptible interrupt handlers now support frame pointers.
- Added `-march=native` for better compatibility with ARM, AArch64, and X86. This
option will be treated like `-mcpu=native` if `-mcpu` is not present. If
@@ -659,12 +956,26 @@ features cannot lower the translation-unit ABI level;
- Added `--cuda-emit-nvcc-abi` to emit the NVCC-compatible host registration ABI
(`__cudaRegisterLinkedBinary`).
+- Fixed CUDA built-in variables such as `threadIdx` and `blockDim` being incorrectly treated as having side effects in assumptions. (#GH181340)
+
+- Clang now provides device-side definitions of `__cxa_pure_virtual()` and
+ `__cxa_deleted_virtual()`; previously, any (potential) call to a pure/deleted
+ virtual function that could not be optimised out would cause the program to
+ fail to assemble. This is now fixed. (#GH49183) (#GH67533)
+
#### AIX Support
#### NetBSD Support
#### WebAssembly Support
+- Added `__builtin_wasm_memory_copy` and `__builtin_wasm_memory_fill` builtins
+ for the WebAssembly `memory.copy` and `memory.fill` bulk memory instructions.
+
+- Fixed a "function signature mismatch" trap at program exit when destroying a
+ temporary that is bound to a reference with static or thread storage
+ duration. (#GH45221)
+
#### AVR Support
#### SystemZ Support
@@ -684,7 +995,8 @@ features cannot lower the translation-unit ABI level;
- Add `AfterRequiresExpression` sub-option of `BraceWrapping` to wrap the
body of requires expressions. It is enabled by the `Allman`, `Whitesmiths`,
and `GNU` styles of `BreakBeforeBraces`.
-
+- Add `AtEndOfBlock` sub-option of `KeepEmptyLines` to control the number of
+ empty lines kept at end of blocks.
- `QualifierOrder` now supports `typedef`, `consteval`, `constinit`,
`thread_local`, `extern`, `mutable`, `signed`, `unsigned`, `long`, `short`,
and `explicit` declaration specifiers.
@@ -692,9 +1004,18 @@ features cannot lower the translation-unit ABI level;
### libclang
- visit identifier initializers in lambda capture as VarDecl instead of VariableRef. Warning: this changes behaviour.
+- add unary operator handling to `clang_getCursorSpelling()`.
### Code Completion
+- Parameters declared with a `decltype` are now presented as the type the
+ `decltype` resolves to, e.g. `set_x(int val)` rather than
+ `set_x(decltype(x) val)`. This affects the completion strings produced by
+ libclang as well as those used by clangd.
+
+- Members inherited from a dependent base class that is named through an alias
+ template are suggested by code completion when relevant.
+
### Static Analyzer
#### Crash and bug fixes
@@ -727,8 +1048,33 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use
### Python Binding Changes
+- Fixed a crash (`SIGFPE`) when traversing an AST via the visitor callbacks
+ (e.g. `Cursor.get_children`) on s390x. The callbacks now return a full
+ register word so the return value is correctly extended, working around a
+ `ctypes` bug (https://github.com/python/cpython/issues/156933) that left the
+ high bytes of the return register uninitialized.
+- Add support for retrieving unary operator information through `Cursor.unary_operator()`.
+
### OpenMP Support
+- Fixed an OpenMP `requires` directive read from a PCH or module losing its effect on
+ semantic checks, which caused spurious `reverse_offload` errors.
+- Added the OpenMP 6.1 `#pragma omp flatten` loop transformation and the
+ `depth` clause. Flatten combines perfectly nested canonical loops into one
+ loop. `depth(k)` selects how many outermost loops to combine (default 2).
+- Canonicalize intra-tiles in loop tiling. `#pragma omp tile` still emits a
+ min-bounded inner loop, which vectorizes well. When a parent directive such as
+ `for collapse(n)` needs a constant per-tile trip count, Clang rereads a
+ droppable hint and treats that inner loop as rectangular, with an overshoot
+ guard only if the last tile can be partial.
+
+ Not yet supported (diagnosed, left as follow-up):
+
+ - `collapse` through stacked `#pragma omp tile` (the inner floor is not a
+ collapsed counter).
+ - A loop transformation (`tile`, `unroll`, `interchange`, ...) that consumes
+ another tile's intra-tile loop.
+
- Added parsing and semantic support for `dims` modifier in `num_teams`,
`thread_limit` and `num_threads` clauses for OpenMP 6.1 or later.
- Map-type-modifying modifiers applied to a list item with a user-defined mapper
@@ -736,6 +1082,26 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use
- Mapping of expressions with base-pointers through a user-defined mapper (e.g.
`map(s.p[0:n])`) now conforms to OpenMP's conditional pointer-attachment,
matching the behavior of such maps outside a mapper.
+- The `holds` clause on the `assume` directive now lowers side-effect-free
+ conditions to `llvm.assume`, enabling downstream optimizations. Previously
+ the clause was parsed but its condition was discarded without effect.
+- Fixed a crash when the loop variable or a loop bound of an OpenMP loop has a
+ `_BitInt` type wider than any standard integer type. (#GH140074)
+
+- Added support for capturing structured bindings in OpenMP regions
+ (a C++20 extension; warned as an extension in C++17). Individual bindings
+ form aggregate decompositions(structs, classes, and arrays) can now be used
+ in data-sharing clauses (``private``, ``firstprivate``, ``lastprivate``,
+ ``shared``, ``linear``) and ``map`` clauses for target directives.
+ Tuple-like bindings (types using the tuple protocol with ``get<N>()``,
+ such as ``std::pair`` or ``std::tuple``) are not yet supported and
+ will produce a compilation error. Reduction clauses with structured bindings
+ are not yet supported.
+ When the original variable is explicitly mapped in a target region
+ but only bindings from it are used (not the original variable itself),
+ modifications to the bindings will not be reflected in the original variable.
+ To ensure correct behavior, either use the original variable directly in the
+ target region or map the bindings explicitly instead.
### SYCL Support
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp
index cf01056f8ffaca3..1b170d73f11cb82 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -21,8 +21,8 @@
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/GlobPattern.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Timer.h"
+#include "llvm/Support/raw_ostream.h"
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -209,22 +209,23 @@ clang::CreateASTPrinter(std::unique_ptr<raw_ostream> Out,
std::unique_ptr<ASTConsumer>
clang::CreateASTDumper(std::unique_ptr<raw_ostream> Out, StringRef FilterString,
- StringRef FilterPath, bool DumpDecls,
- bool Deserialize, bool DumpLookups,
- bool DumpDeclTypes, ASTDumpOutputFormat Format) {
+ StringRef FilterPath, bool DumpDecls, bool Deserialize,
+ bool DumpLookups, bool DumpDeclTypes,
+ ASTDumpOutputFormat Format) {
assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
- return std::make_unique<ASTPrinter>(
- std::move(Out),
- Deserialize ? ASTPrinter::DumpFull
- : DumpDecls ? ASTPrinter::Dump : ASTPrinter::None,
- Format, FilterString, FilterPath, DumpLookups, DumpDeclTypes);
+ return std::make_unique<ASTPrinter>(std::move(Out),
+ Deserialize ? ASTPrinter::DumpFull
+ : DumpDecls ? ASTPrinter::Dump
+ : ASTPrinter::None,
+ Format, FilterString, FilterPath,
+ DumpLookups, DumpDeclTypes);
}
std::unique_ptr<ASTConsumer>
clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString,
- StringRef FilterPath, bool DumpDecls,
- bool Deserialize, bool DumpLookups,
- bool DumpDeclTypes, ASTDumpOutputFormat Format) {
+ StringRef FilterPath, bool DumpDecls, bool Deserialize,
+ bool DumpLookups, bool DumpDeclTypes,
+ ASTDumpOutputFormat Format) {
assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
return std::make_unique<ASTPrinter>(Out,
Deserialize ? ASTPrinter::DumpFull
More information about the cfe-commits
mailing list