Skip to content

Commit db4798b

Browse files
authored
Merge branch 'main' into lower-cir-int
2 parents bd73580 + a9b3e11 commit db4798b

File tree

681 files changed

+20968
-10805
lines changed

Some content is hidden

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

681 files changed

+20968
-10805
lines changed

.github/new-prs-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ llvm:regalloc:
730730
lldb:
731731
- lldb/**
732732

733+
lldb-dap:
734+
- lldb/tools/lldb-dap/**
735+
733736
backend:AMDGPU:
734737
- '**/*amdgpu*'
735738
- '**/*AMDGPU*'

.github/workflows/premerge.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ permissions:
55

66
on:
77
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
# When a PR is closed, we still start this workflow, but then skip
13+
# all the jobs, which makes it effectively a no-op. The reason to
14+
# do this is that it allows us to take advantage of concurrency groups
15+
# to cancel in progress CI jobs whenever the PR is closed.
16+
- closed
817
paths:
918
- .github/workflows/premerge.yaml
1019
push:
@@ -14,7 +23,9 @@ on:
1423

1524
jobs:
1625
premerge-checks-linux:
17-
if: github.repository_owner == 'llvm'
26+
if: >-
27+
github.repository_owner == 'llvm' &&
28+
(github.event_name != 'pull_request' || github.event.action != 'closed')
1829
runs-on: llvm-premerge-linux-runners
1930
concurrency:
2031
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
@@ -73,7 +84,9 @@ jobs:
7384
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
7485
7586
premerge-checks-windows:
76-
if: github.repository_owner == 'llvm'
87+
if: >-
88+
github.repository_owner == 'llvm' &&
89+
(github.event_name != 'pull_request' || github.event.action != 'closed')
7790
runs-on: llvm-premerge-windows-runners
7891
concurrency:
7992
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
@@ -139,8 +152,10 @@ jobs:
139152
group: ${{ github.workflow }}-macos-${{ github.event.pull_request.number || github.sha }}
140153
cancel-in-progress: true
141154
if: >-
155+
github.repository_owner == 'llvm' &&
142156
(startswith(github.ref_name, 'release/') ||
143-
startswith(github.base_ref, 'refs/heads/release/'))
157+
startswith(github.base_ref, 'release/')) &&
158+
(github.event_name != 'pull_request' || github.event.action != 'closed')
144159
steps:
145160
- name: Checkout LLVM
146161
uses: actions/checkout@v4

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,10 @@ jobs:
8989
needs:
9090
- validate-tag
9191
- release-create
92-
strategy:
93-
fail-fast: false
94-
matrix:
95-
runs-on:
96-
- ubuntu-22.04
97-
- windows-2022
98-
- macos-13
99-
- macos-14
100-
101-
uses: ./.github/workflows/release-binaries.yml
92+
uses: ./.github/workflows/release-binaries-all.yml
10293
with:
10394
release-version: ${{ needs.validate-tag.outputs.release-version }}
10495
upload: true
105-
runs-on: ${{ matrix.runs-on }}
10696
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
10797
secrets:
10898
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

bolt/test/X86/dynamic-relocs-on-entry.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
# RUN: %clang %cflags -fPIC -pie %s -o %t.exe -nostdlib -Wl,-q
66
# RUN: llvm-bolt %t.exe -o %t.bolt > %t.out.txt
7-
# RUN: readelf -r %t.bolt >> %t.out.txt
7+
# RUN: llvm-readelf -r %t.bolt >> %t.out.txt
88
# RUN: llvm-objdump --disassemble-symbols=chain %t.bolt >> %t.out.txt
99
# RUN: FileCheck %s --input-file=%t.out.txt
1010

1111
## Check if the new address in `chain` is correctly updated by BOLT
12-
# CHECK: Relocation section '.rela.dyn' at offset 0x{{.*}} contains 1 entry:
12+
# CHECK: Relocation section '.rela.dyn' at offset 0x{{.*}} contains 1 entries:
1313
# CHECK: {{.*}} R_X86_64_RELATIVE [[#%x,ADDR:]]
1414
# CHECK: [[#ADDR]]: c3 retq
1515
.text
@@ -29,4 +29,4 @@ _start:
2929

3030
.data
3131
.Lfoo:
32-
.quad Label
32+
.quad Label

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Resolutions to C++ Defect Reports
8383
C Language Changes
8484
------------------
8585

86+
- Clang now allows an ``inline`` specifier on a typedef declaration of a
87+
function type in Microsoft compatibility mode. #GH124869
88+
8689
C2y Feature Support
8790
^^^^^^^^^^^^^^^^^^^
8891

@@ -110,6 +113,13 @@ Attribute Changes in Clang
110113
Improvements to Clang's diagnostics
111114
-----------------------------------
112115

116+
- Improve the diagnostics for deleted default constructor errors for C++ class
117+
initializer lists that don't explicitly list a class member and thus attempt
118+
to implicitly default construct that member.
119+
- The ``-Wunique-object-duplication`` warning has been added to warn about objects
120+
which are supposed to only exist once per program, but may get duplicated when
121+
built into a shared library.
122+
113123
Improvements to Clang's time-trace
114124
----------------------------------
115125

clang/docs/analyzer/user-docs/Annotations.rst

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ recognized by GCC. Their use can be conditioned using preprocessor macros
2323
.. contents::
2424
:local:
2525

26-
Annotations to Enhance Generic Checks
27-
_____________________________________
26+
General Purpose Annotations
27+
___________________________
2828

2929
Null Pointer Checking
3030
#####################
@@ -79,15 +79,15 @@ implemented with a macro, with the macro performing a check for the assertion
7979
condition and, when the check fails, calling an assertion handler. For
8080
example, consider the following code fragment:
8181

82-
.. code-block: c
82+
.. code-block:: c
8383
8484
void foo(int *p) {
8585
assert(p != NULL);
8686
}
8787
8888
When this code is preprocessed on Mac OS X it expands to the following:
8989

90-
.. code-block: c
90+
.. code-block:: c
9191
9292
void foo(int *p) {
9393
(__builtin_expect(!(p != NULL), 0) ? __assert_rtn(__func__, "t.c", 4, "p != NULL") : (void)0);
@@ -131,7 +131,7 @@ return.
131131
On Mac OS X, the function prototype for ``__assert_rtn`` (declared in
132132
``assert.h``) is specifically annotated with the 'noreturn' attribute:
133133

134-
.. code-block: c
134+
.. code-block:: c
135135
136136
void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__));
137137
@@ -151,7 +151,7 @@ the use of preprocessor macros.
151151

152152
**Example**
153153

154-
.. code-block: c
154+
.. code-block:: c
155155
156156
#ifndef CLANG_ANALYZER_NORETURN
157157
#if __has_feature(attribute_analyzer_noreturn)
@@ -163,6 +163,43 @@ the use of preprocessor macros.
163163
164164
void my_assert_rtn(const char *, const char *, int, const char *) CLANG_ANALYZER_NORETURN;
165165
166+
Dynamic Memory Modeling Annotations
167+
###################################
168+
169+
If a project uses custom functions for dynamic memory management (that e.g. act as wrappers around ``malloc``/``free`` or ``new``/``delete`` in C++) and the analyzer cannot "see" the _definitions_ of these functions, it's possible to annotate their declarations to let the analyzer model their behavior. (Otherwise the analyzer cannot know that the opaque ``my_free()`` is basically equivalent to a standard ``free()`` call.)
170+
171+
.. note::
172+
**This page only provides a brief list of these annotations.** For a full documentation, see the main `Attributes in Clang <../../AttributeReference.html#ownership-holds-ownership-returns-ownership-takes-clang-static-analyzer>`_ page.
173+
174+
Attribute 'ownership_returns' (Clang-specific)
175+
----------------------------------------------
176+
177+
Use this attribute to mark functions that return dynamically allocated memory. Takes a single argument, the type of the allocation (e.g. ``malloc`` or ``new``).
178+
179+
.. code-block:: c
180+
181+
void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
182+
183+
Attribute 'ownership_takes' (Clang-specific)
184+
--------------------------------------------
185+
186+
Use this attribute to mark functions that deallocate memory. Takes two arguments: the type of the allocation (e.g. ``malloc`` or ``new``) and the index of the parameter that is being deallocated (counting from 1).
187+
188+
.. code-block:: c
189+
190+
void __attribute((ownership_takes(malloc, 1))) my_free(void *);
191+
192+
Attribute 'ownership_holds' (Clang-specific)
193+
--------------------------------------------
194+
195+
Use this attribute to mark functions that take ownership of memory and will deallocate it at some unspecified point in the future. Takes two arguments: the type of the allocation (e.g. ``malloc`` or ``new``) and the index of the parameter that is being held (counting from 1).
196+
197+
.. code-block:: c
198+
199+
void __attribute((ownership_holds(malloc, 2))) store_in_table(int key, record_t *val);
200+
201+
The annotations ``ownership_takes`` and ``ownership_holds`` both prevent memory leak reports (concerning the specified argument); the difference between them is that using taken memory is a use-after-free error, while using held memory is assumed to be legitimate.
202+
166203
Mac OS X API Annotations
167204
________________________
168205

@@ -207,7 +244,7 @@ functions allows the analyzer to perform extra checking.
207244

208245
**Example**
209246

210-
.. code-block: objc
247+
.. code-block:: objc
211248
212249
#import <Foundation/Foundation.h>;
213250
@@ -597,7 +634,6 @@ returned object.
597634
LIBKERN_RETURNS_NOT_RETAINED OSObject *myFieldGetter();
598635
}
599636
600-
601637
// Note that the annotation only has to be applied to the function declaration.
602638
OSObject * MyClass::myFieldGetter() {
603639
return f;

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,11 @@ enum CXCursorKind {
22062206
*/
22072207
CXCursor_OpenACCUpdateConstruct = 331,
22082208

2209-
CXCursor_LastStmt = CXCursor_OpenACCUpdateConstruct,
2209+
/** OpenACC atomic Construct.
2210+
*/
2211+
CXCursor_OpenACCAtomicConstruct = 332,
2212+
2213+
CXCursor_LastStmt = CXCursor_OpenACCAtomicConstruct,
22102214

22112215
/**
22122216
* Cursor that represents the translation unit itself.

clang/include/clang/AST/DeclBase.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,11 @@ class alignas(8) Decl {
12571257
int64_t getID() const;
12581258

12591259
/// Looks through the Decl's underlying type to extract a FunctionType
1260-
/// when possible. Will return null if the type underlying the Decl does not
1261-
/// have a FunctionType.
1260+
/// when possible. This includes direct FunctionDecls, along with various
1261+
/// function types and typedefs. This includes function pointers/references,
1262+
/// member function pointers, and optionally if \p BlocksToo is set
1263+
/// Objective-C block pointers. Returns nullptr if the type underlying the
1264+
/// Decl does not have a FunctionType.
12621265
const FunctionType *getFunctionType(bool BlocksToo = true) const;
12631266

12641267
// Looks through the Decl's underlying type to determine if it's a

clang/include/clang/AST/ExprCXX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5040,7 +5040,7 @@ class CXXParenListInitExpr final
50405040
}
50415041

50425042
const FieldDecl *getInitializedFieldInUnion() const {
5043-
return ArrayFillerOrUnionFieldInit.dyn_cast<FieldDecl *>();
5043+
return dyn_cast_if_present<FieldDecl *>(ArrayFillerOrUnionFieldInit);
50445044
}
50455045

50465046
child_range children() {

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,6 +4099,8 @@ DEF_TRAVERSE_STMT(OpenACCSetConstruct,
40994099
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
41004100
DEF_TRAVERSE_STMT(OpenACCUpdateConstruct,
41014101
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4102+
DEF_TRAVERSE_STMT(OpenACCAtomicConstruct,
4103+
{ TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
41024104

41034105
// Traverse HLSL: Out argument expression
41044106
DEF_TRAVERSE_STMT(HLSLOutArgExpr, {})

0 commit comments

Comments
 (0)