Skip to content

Commit 7ee38b8

Browse files
committed
Merge branch 'main' into pr-riscv-deinterleave48-shuffle-lowering
2 parents a75537d + b8805c8 commit 7ee38b8

File tree

312 files changed

+18924
-2106
lines changed

Some content is hidden

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

312 files changed

+18924
-2106
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
# to receive an approval from a "code owner" in particular -- any LLVM project
88
# member can approve pull requests.
99
#
10-
# Note that GitHub's concept of "code owner" is independent from LLVM's own
11-
# "code owner" concept, they merely happen to share terminology. See
12-
# https://llvm.org/docs/DeveloperPolicy.html#code-owners, as well as the
13-
# CODE_OWNERS.txt files in the respective subproject directories.
10+
# This is independent of LLVM's own "maintainer" concept.
11+
# See https://llvm.org/docs/DeveloperPolicy.html#maintainers as well as the
12+
# Maintainers.* files in the the respective subproject directories.
1413

1514
/libcxx/ @llvm/reviewers-libcxx
1615
/libcxxabi/ @llvm/reviewers-libcxxabi

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes
163163
TZ=UTC ninja -C libc-build docs-libc-html
164164
mkdir built-docs/libc
165-
cp -r libc-build/docs/* built-docs/libc/
165+
cp -r libc-build/libc/docs/* built-docs/libc/
166166
- name: Build LLD docs
167167
if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true'
168168
run: |

clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "ReturnConstRefFromParameterCheck.h"
10+
#include "clang/AST/Attrs.inc"
1011
#include "clang/AST/Expr.h"
1112
#include "clang/ASTMatchers/ASTMatchFinder.h"
1213
#include "clang/ASTMatchers/ASTMatchers.h"
@@ -15,14 +16,23 @@ using namespace clang::ast_matchers;
1516

1617
namespace clang::tidy::bugprone {
1718

19+
namespace {
20+
21+
AST_MATCHER(ParmVarDecl, hasLifetimeBoundAttr) {
22+
return Node.hasAttr<LifetimeBoundAttr>();
23+
}
24+
25+
} // namespace
26+
1827
void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
1928
const auto DRef = ignoringParens(
2029
declRefExpr(
2130
to(parmVarDecl(hasType(hasCanonicalType(
2231
qualType(lValueReferenceType(pointee(
2332
qualType(isConstQualified()))))
2433
.bind("type"))),
25-
hasDeclContext(functionDecl().bind("owner")))
34+
hasDeclContext(functionDecl().bind("owner")),
35+
unless(hasLifetimeBoundAttr()))
2636
.bind("param")))
2737
.bind("dref"));
2838
const auto Func =

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ Changes in existing checks
184184
<clang-tidy/checks/bugprone/return-const-ref-from-parameter>` check to
185185
diagnose potential dangling references when returning a ``const &`` parameter
186186
by using the conditional operator ``cond ? var1 : var2`` and no longer giving
187-
false positives for functions which contain lambda.
187+
false positives for functions which contain lambda and ignore parameters
188+
with ``[[clang::lifetimebound]]`` attribute.
188189

189190
- Improved :doc:`bugprone-sizeof-expression
190191
<clang-tidy/checks/bugprone/sizeof-expression>` check to find suspicious

clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ after the call. When the function returns such a parameter also as constant refe
1212
then the returned reference can be used after the object it refers to has been
1313
destroyed.
1414

15-
This issue can be resolved by declaring an overload of the problematic function
16-
where the ``const &`` parameter is instead declared as ``&&``. The developer has
17-
to ensure that the implementation of that function does not produce a
18-
use-after-free, the exact error that this check is warning against.
19-
Marking such an ``&&`` overload as ``deleted``, will silence the warning as
20-
well. In the case of different ``const &`` parameters being returned depending
21-
on the control flow of the function, an overload where all problematic
22-
``const &`` parameters have been declared as ``&&`` will resolve the issue.
23-
2415
Example
2516
-------
2617

@@ -38,3 +29,23 @@ Example
3829

3930
const S& s = fn(S{1});
4031
s.v; // use after free
32+
33+
34+
This issue can be resolved by declaring an overload of the problematic function
35+
where the ``const &`` parameter is instead declared as ``&&``. The developer has
36+
to ensure that the implementation of that function does not produce a
37+
use-after-free, the exact error that this check is warning against.
38+
Marking such an ``&&`` overload as ``deleted``, will silence the warning as
39+
well. In the case of different ``const &`` parameters being returned depending
40+
on the control flow of the function, an overload where all problematic
41+
``const &`` parameters have been declared as ``&&`` will resolve the issue.
42+
43+
This issue can also be resolved by adding ``[[clang::lifetimebound]]``. Clang
44+
enable ``-Wdangling`` warning by default which can detect mis-uses of the
45+
annotated function. See `lifetimebound attribute <https://clang.llvm.org/docs/AttributeReference.html#id11>`_
46+
for details.
47+
48+
.. code-block:: c++
49+
50+
const int &f(const int &a [[clang::lifetimebound]]) { return a; } // no warning
51+
const int &v = f(1); // warning: temporary bound to local reference 'v' will be destroyed at the end of the full-expression [-Wdangling]

clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,9 @@ int const &overload_params_difference3(int p1, int const &a, int p2) { return a;
197197
int const &overload_params_difference3(int p1, long &&a, int p2);
198198

199199
} // namespace overload
200+
201+
namespace gh117696 {
202+
namespace use_lifetime_bound_attr {
203+
int const &f(int const &a [[clang::lifetimebound]]) { return a; }
204+
} // namespace use_lifetime_bound_attr
205+
} // namespace gh117696

clang/docs/ClangFormat.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
4949
supported:
5050
CSharp: .cs
5151
Java: .java
52-
JavaScript: .mjs .js .ts
52+
JavaScript: .js .mjs .cjs .ts
5353
Json: .json
5454
Objective-C: .m .mm
5555
Proto: .proto .protodevel

clang/docs/LanguageExtensions.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ Enumerations with a fixed underlying type
19891989
-----------------------------------------
19901990
19911991
Clang provides support for C++11 enumerations with a fixed underlying type
1992-
within Objective-C. For example, one can write an enumeration type as:
1992+
within Objective-C and C `prior to C23 <https://open-std.org/JTC1/SC22/WG14/www/docs/n3030.htm>`_. For example, one can write an enumeration type as:
19931993
19941994
.. code-block:: c++
19951995
@@ -2001,6 +2001,14 @@ value, is ``unsigned char``.
20012001
Use ``__has_feature(objc_fixed_enum)`` to determine whether support for fixed
20022002
underlying types is available in Objective-C.
20032003
2004+
Use ``__has_extension(c_fixed_enum)`` to determine whether support for fixed
2005+
underlying types is available in C prior to C23. This will also report ``true`` in C23
2006+
and later modes as the functionality is available even if it's not an extension in
2007+
those modes.
2008+
2009+
Use ``__has_feature(c_fixed_enum)`` to determine whether support for fixed
2010+
underlying types is available in C23 and later.
2011+
20042012
Interoperability with C++11 lambdas
20052013
-----------------------------------
20062014

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ Resolutions to C++ Defect Reports
310310
by default.
311311
(`CWG2521: User-defined literals and reserved identifiers <https://cplusplus.github.io/CWG/issues/2521.html>`_).
312312

313+
- Fix name lookup for a dependent base class that is the current instantiation.
314+
(`CWG591: When a dependent base class is the current instantiation <https://cplusplus.github.io/CWG/issues/591.html>`_).
315+
313316
C Language Changes
314317
------------------
315318

@@ -968,6 +971,8 @@ AST Matchers
968971
- Ensure ``hasName`` matches template specializations across inline namespaces,
969972
making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent.
970973

974+
- Improved the performance of the ``getExpansionLocOfMacro`` by tracking already processed macros during recursion.
975+
971976
- Add ``exportDecl`` matcher to match export declaration.
972977

973978
clang-format

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4930,6 +4930,12 @@ def HLSLClip: LangBuiltin<"HLSL_LANG"> {
49304930
let Prototype = "void(...)";
49314931
}
49324932

4933+
def HLSLGroupMemoryBarrierWithGroupSync: LangBuiltin<"HLSL_LANG"> {
4934+
let Spellings = ["__builtin_hlsl_group_memory_barrier_with_group_sync"];
4935+
let Attributes = [NoThrow, Const];
4936+
let Prototype = "void()";
4937+
}
4938+
49334939
// Builtins for XRay.
49344940
def XRayCustomEvent : Builtin {
49354941
let Spellings = ["__xray_customevent"];

0 commit comments

Comments
 (0)