Skip to content

Commit c5383c4

Browse files
authored
Merge branch 'main' into test-lib-llvm-path
2 parents eba4df0 + 8871e9e commit c5383c4

File tree

478 files changed

+20849
-6823
lines changed

Some content is hidden

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

478 files changed

+20849
-6823
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,9 +4765,21 @@ the configuration (without a prefix: ``Auto``).
47654765
Decimal: 3
47664766
Hex: -1
47674767

4768-
You can also specify a minimum number of digits (``BinaryMinDigits``,
4769-
``DecimalMinDigits``, and ``HexMinDigits``) the integer literal must
4770-
have in order for the separators to be inserted.
4768+
You can also specify a minimum number of digits
4769+
(``BinaryMinDigitsInsert``, ``DecimalMinDigitsInsert``, and
4770+
``HexMinDigitsInsert``) the integer literal must have in order for the
4771+
separators to be inserted, and a maximum number of digits
4772+
(``BinaryMaxDigitsRemove``, ``DecimalMaxDigitsRemove``, and
4773+
``HexMaxDigitsRemove``) until the separators are removed. This divides the
4774+
literals in 3 regions, always without separator (up until including
4775+
``xxxMaxDigitsRemove``), maybe with, or without separators (up until
4776+
excluding ``xxxMinDigitsInsert``), and finally always with separators.
4777+
4778+
.. note::
4779+
4780+
``BinaryMinDigits``, ``DecimalMinDigits``, and ``HexMinDigits`` are
4781+
deprecated and renamed to ``BinaryMinDigitsInsert``,
4782+
``DecimalMinDigitsInsert``, and ``HexMinDigitsInsert``, respectively.
47714783

47724784
* ``int8_t Binary`` Format separators in binary literals.
47734785

@@ -4778,15 +4790,28 @@ the configuration (without a prefix: ``Auto``).
47784790
/* 3: */ b = 0b100'111'101'101;
47794791
/* 4: */ b = 0b1001'1110'1101;
47804792
4781-
* ``int8_t BinaryMinDigits`` Format separators in binary literals with a minimum number of digits.
4793+
* ``int8_t BinaryMinDigitsInsert`` Format separators in binary literals with a minimum number of digits.
47824794

47834795
.. code-block:: text
47844796
47854797
// Binary: 3
4786-
// BinaryMinDigits: 7
4798+
// BinaryMinDigitsInsert: 7
47874799
b1 = 0b101101;
47884800
b2 = 0b1'101'101;
47894801
4802+
* ``int8_t BinaryMaxDigitsRemove`` Remove separators in binary literals with a maximum number of digits.
4803+
4804+
.. code-block:: text
4805+
4806+
// Binary: 3
4807+
// BinaryMinDigitsInsert: 7
4808+
// BinaryMaxDigitsRemove: 4
4809+
b0 = 0b1011; // Always removed.
4810+
b1 = 0b101101; // Not added.
4811+
b2 = 0b1'01'101; // Not removed, not corrected.
4812+
b3 = 0b1'101'101; // Always added.
4813+
b4 = 0b10'1101; // Corrected to 0b101'101.
4814+
47904815
* ``int8_t Decimal`` Format separators in decimal literals.
47914816

47924817
.. code-block:: text
@@ -4795,15 +4820,28 @@ the configuration (without a prefix: ``Auto``).
47954820
/* 0: */ d = 184467'440737'0'95505'92ull;
47964821
/* 3: */ d = 18'446'744'073'709'550'592ull;
47974822
4798-
* ``int8_t DecimalMinDigits`` Format separators in decimal literals with a minimum number of digits.
4823+
* ``int8_t DecimalMinDigitsInsert`` Format separators in decimal literals with a minimum number of digits.
47994824

48004825
.. code-block:: text
48014826
48024827
// Decimal: 3
4803-
// DecimalMinDigits: 5
4828+
// DecimalMinDigitsInsert: 5
48044829
d1 = 2023;
48054830
d2 = 10'000;
48064831
4832+
* ``int8_t DecimalMaxDigitsRemove`` Remove separators in decimal literals with a maximum number of digits.
4833+
4834+
.. code-block:: text
4835+
4836+
// Decimal: 3
4837+
// DecimalMinDigitsInsert: 7
4838+
// DecimalMaxDigitsRemove: 4
4839+
d0 = 2023; // Always removed.
4840+
d1 = 123456; // Not added.
4841+
d2 = 1'23'456; // Not removed, not corrected.
4842+
d3 = 5'000'000; // Always added.
4843+
d4 = 1'23'45; // Corrected to 12'345.
4844+
48074845
* ``int8_t Hex`` Format separators in hexadecimal literals.
48084846

48094847
.. code-block:: text
@@ -4812,16 +4850,30 @@ the configuration (without a prefix: ``Auto``).
48124850
/* 0: */ h = 0xDEAD'BEEF'DE'AD'BEE'Fuz;
48134851
/* 2: */ h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz;
48144852
4815-
* ``int8_t HexMinDigits`` Format separators in hexadecimal literals with a minimum number of
4853+
* ``int8_t HexMinDigitsInsert`` Format separators in hexadecimal literals with a minimum number of
48164854
digits.
48174855

48184856
.. code-block:: text
48194857
48204858
// Hex: 2
4821-
// HexMinDigits: 6
4859+
// HexMinDigitsInsert: 6
48224860
h1 = 0xABCDE;
48234861
h2 = 0xAB'CD'EF;
48244862
4863+
* ``int8_t HexMaxDigitsRemove`` Remove separators in hexadecimal literals with a maximum number of
4864+
digits.
4865+
4866+
.. code-block:: text
4867+
4868+
// Hex: 2
4869+
// HexMinDigitsInsert: 6
4870+
// HexMaxDigitsRemove: 4
4871+
h0 = 0xAFFE; // Always removed.
4872+
h1 = 0xABCDE; // Not added.
4873+
h2 = 0xABC'DE; // Not removed, not corrected.
4874+
h3 = 0xAB'CD'EF; // Always added.
4875+
h4 = 0xABCD'E; // Corrected to 0xA'BC'DE.
4876+
48254877
48264878
.. _JavaImportGroups:
48274879

clang/docs/ClangStaticAnalyzer.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Clang Static Analyzer
55
The Clang Static Analyzer is a source code analysis tool that finds bugs in C, C++, and Objective-C programs.
66
It implements *path-sensitive*, *inter-procedural analysis* based on *symbolic execution* technique.
77

8-
This is the Static Analyzer documentation page.
8+
The Static Analyzer is a part of Clang; for downloading and installing Clang visit the `LLVM releases page <https://releases.llvm.org/>`_.
99

10-
See the `Official Tool Page <https://clang-analyzer.llvm.org/>`_.
10+
This is the documentation page of the Static Analyzer; there is also an old `Official Tool Page <https://clang-analyzer.llvm.org/>`_ which provides a short overview of features and limitations.
1111

1212
.. toctree::
1313
:caption: Table of Contents

clang/docs/HIPSupport.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,43 @@ Example Usage
376376
basePtr->virtualFunction(); // Allowed since obj is constructed in device code
377377
}
378378

379+
Alias Attribute Support
380+
=======================
381+
382+
Clang supports alias attributes in HIP code, allowing creation of alternative names for functions and variables.
383+
- Aliases work with ``__host__``, ``__device__``, and ``__host__ __device__`` functions and variables.
384+
- The alias attribute uses the syntax ``__attribute__((alias("target_name")))``. Both weak and strong aliases are supported.
385+
- Outside of ``extern "C"``, the alias target must use the mangled name of the aliasee
386+
- The alias is only emitted if the aliasee is emitted on the same side (ie __host__ or __device__), otherwise it is ignored.
387+
388+
Example Usage
389+
-------------
390+
391+
.. code-block:: c++
392+
393+
extern "C" {
394+
// Host function alias
395+
int __HostFunc(void) { return 0; }
396+
int HostFunc(void) __attribute__((weak, alias("__HostFunc")));
397+
398+
// Device function alias
399+
__device__ int __DeviceFunc(void) { return 1; }
400+
__device__ int DeviceFunc(void) __attribute__((weak, alias("__DeviceFunc")));
401+
402+
// Host-device function alias
403+
__host__ __device__ int __BothFunc(void) { return 2; }
404+
__host__ __device__ int BothFunc(void) __attribute__((alias("__BothFunc")));
405+
406+
// Variable alias
407+
int __host_var = 3;
408+
extern int __attribute__((weak, alias("__host_var"))) host_var;
409+
}
410+
// Mangled / overload alias
411+
__host__ __device__ float __Four(float f) { return 2.0f * f; }
412+
__host__ __device__ int Four(void) __attribute__((weak, alias("_Z6__Fourv")));
413+
__host__ __device__ float Four(float f) __attribute__((weak, alias("_Z6__Fourf")));
414+
415+
379416
Host and Device Attributes of Default Destructors
380417
===================================================
381418

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ Improvements to Clang's diagnostics
396396
- Fixed false positives in ``-Waddress-of-packed-member`` diagnostics when
397397
potential misaligned members get processed before they can get discarded.
398398
(#GH144729)
399+
- Fix a false positive warning in ``-Wignored-qualifiers`` when the return type is undeduced. (#GH43054)
399400

400401
- Clang now emits a diagnostic with the correct message in case of assigning to const reference captured in lambda. (#GH105647)
401402

@@ -703,6 +704,9 @@ clang-format
703704
``AlignAfterOpenBracket`` option, and make ``AlignAfterOpenBracket`` a
704705
``bool`` type.
705706
- Add ``AlignPPAndNotPP`` suboption to ``AlignTrailingComments``.
707+
- Rename ``(Binary|Decimal|Hex)MinDigits`` to ``...MinDigitsInsert`` and add
708+
``(Binary|Decimal|Hex)MaxDigitsSeparator`` suboptions to
709+
``IntegerLiteralSeparator``.
706710

707711
libclang
708712
--------

clang/docs/analyzer/user-docs.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Contents:
66
.. toctree::
77
:maxdepth: 2
88

9-
user-docs/Installation
109
user-docs/CommandLineUsage
1110
user-docs/Options
1211
user-docs/UsingWithXCode

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ It is possible, however, to invoke the static analyzer from the command line in
1616
The following tools are used commonly to run the analyzer from the command line.
1717
Both tools are wrapper scripts to drive the analysis and the underlying invocations of the Clang compiler:
1818

19-
1. scan-build_ is an old and simple command line tool that emits static analyzer warnings as HTML files while compiling your project. You can view the analysis results in your web browser.
19+
1. scan-build_ is an old and simple command line tool that emits static analyzer warnings as HTML files while compiling your project. You can view the analysis results in your web browser; the utility script ``scan-view`` can provide a trivial HTTP server that servers these result files.
20+
- Is available as a part of the LLVM project (together with ``scan-view``).
2021
- Useful for individual developers who simply want to view static analysis results at their desk, or in a very simple collaborative environment.
2122
- Works on all major platforms (Windows, Linux, macOS) and is available as a package in many Linux distributions.
2223
- Does not include support for cross-translation-unit analysis.
2324

2425
2. CodeChecker_ is a driver and web server that runs the static analyzer on your projects on demand and maintains a database of issues.
26+
- Open source, but out-of-tree, i.e. not part of the LLVM project.
2527
- Perfect for managing large amounts of thee static analyzer warnings in a collaborative environment.
2628
- Generally much more feature-rich than scan-build.
2729
- Supports incremental analysis: Results can be stored in a database, subsequent analysis runs can be compared to list the newly added defects.
2830
- :doc:`CrossTranslationUnit` is supported fully on Linux via CodeChecker.
29-
- Can run clang-tidy checkers too.
30-
- Open source, but out-of-tree, i.e. not part of the LLVM project.
31+
- Can also run clang-tidy checks and various other analysis tools.
3132

3233
scan-build
3334
----------
Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
1+
:orphan:
2+
13
Obtaining the Static Analyzer
24
=============================
35

4-
This page describes how to download and install the analyzer. Once the analyzer is installed, follow the :doc:`CommandLineUsage` on using the command line to get started analyzing your code.
5-
6-
.. contents::
7-
:local:
8-
9-
10-
Building the Analyzer from Source
11-
---------------------------------
12-
13-
Currently there are no officially supported binary distributions for the static analyzer.
14-
You must build Clang and LLVM manually.
15-
To do so, please follow the instructions for `building Clang from source code <https://clang.llvm.org/get_started.html#build>`_.
16-
17-
Once the Clang is built, you need to add the location of the ``clang`` binary and the locations of the command line utilities (`CodeChecker` or ``scan-build`` and ``scan-view``) to you PATH for :doc:`CommandLineUsage`.
18-
19-
[Legacy] Packaged Builds (Mac OS X)
20-
-----------------------------------
21-
22-
Semi-regular pre-built binaries of the analyzer used to be available on Mac OS X. These were built to run on OS X 10.7 and later.
23-
24-
For older builds for MacOS visit https://clang-analyzer.llvm.org/release_notes.html.
25-
26-
Packaged builds for other platforms may eventually be provided, but we need volunteers who are willing to help provide such regular builds. If you wish to help contribute regular builds of the analyzer on other platforms, please get in touch via `LLVM Discourse <https://discourse.llvm.org/>`_.
27-
28-
[Legacy] Using Packaged Builds
29-
------------------------------
30-
31-
To use the legacy package builds, simply unpack it anywhere. If the build archive has the name **``checker-XXX.tar.bz2``** then the archive will expand to a directory called **``checker-XXX``**. You do not need to place this directory or the contents of this directory in any special place. Uninstalling the analyzer is as simple as deleting this directory.
32-
33-
Most of the files in the **``checker-XXX``** directory will be supporting files for the analyzer that you can simply ignore. Most users will only care about two files, which are located at the top of the **``checker-XXX``** directory:
34-
35-
* **scan-build**: ``scan-build`` is the high-level command line utility for running the analyzer
36-
* **scan-view**: ``scan-view`` a companion command line utility to ``scan-build``, ``scan-view`` is used to view analysis results generated by ``scan-build``. There is an option that one can pass to ``scan-build`` to cause ``scan-view`` to run as soon as it the analysis of a build completes
37-
6+
The Static Analyzer can be obtained as a part of Clang; for downloading and installing Clang visit the `LLVM releases page <https://releases.llvm.org/>`_. Once the analyzer is installed, follow the :doc:`CommandLineUsage` on using the command line to get started analyzing your code.

0 commit comments

Comments
 (0)