Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release/18.x' into rustc/18.0-…
Browse files Browse the repository at this point in the history
…2024-02-13
  • Loading branch information
nikic committed Feb 21, 2024
2 parents 9ea7f73 + 6c90f8d commit 3e722cc
Show file tree
Hide file tree
Showing 165 changed files with 6,067 additions and 722 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
lit-tests:
name: Lit Tests
runs-on: ${{ matrix.os }}
container:
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
volumes:
- /mnt/:/mnt/
strategy:
fail-fast: false
matrix:
Expand All @@ -77,6 +81,7 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
- name: Install Ninja
if: runner.os != 'Linux'
uses: llvm/actions/install-ninja@main
# actions/checkout deletes any existing files in the new git directory,
# so this needs to either run before ccache-action or it has to use
Expand Down Expand Up @@ -108,8 +113,8 @@ jobs:
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
builddir="/mnt/build/"
sudo mkdir -p $builddir
sudo chown `whoami`:`whoami` $builddir
mkdir -p $builddir
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
else
builddir="$(pwd)"/build
fi
Expand All @@ -123,6 +128,7 @@ jobs:
-DLLDB_INCLUDE_TESTS=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
$extra_cmake_args \
${{ inputs.extra_cmake_args }}
ninja -C "$builddir" '${{ inputs.build_target }}'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
name: Create a New Release
runs-on: ubuntu-latest
needs: validate-tag

steps:
- name: Install Dependencies
run: |
Expand All @@ -40,8 +41,9 @@ jobs:
- name: Create Release
env:
GITHUB_TOKEN: ${{ github.token }}
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} create
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" create
release-documentation:
name: Build and Upload Release Documentation
needs:
Expand Down
54 changes: 51 additions & 3 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ AST Dumping Potentially Breaking Changes
"qualType": "foo"
}
Clang Frontend Potentially Breaking Changes
-------------------------------------------
- Target OS macros extension
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
these targets, which could break existing code bases with improper checks for
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
macros undefined and guarded code unexercised.

Affected code should be checked to see if it's still intended for the specific
target and fixed accordingly.

The extension can be turned off by the option ``-fno-define-target-os-macros``
as a workaround.

What's New in Clang |release|?
==============================
Some of the major new features and improvements to Clang are listed
Expand Down Expand Up @@ -304,6 +320,10 @@ Non-comprehensive list of changes in this release

* The version of Unicode used by Clang (primarily to parse identifiers) has been updated to 15.1.

* Clang now defines macro ``__LLVM_INSTR_PROFILE_GENERATE`` when compiling with
PGO instrumentation profile generation, and ``__LLVM_INSTR_PROFILE_USE`` when
compiling with PGO profile use.

New Compiler Flags
------------------

Expand Down Expand Up @@ -344,6 +364,17 @@ New Compiler Flags
attribute the replaceable global new and delete operators behave normally
(like other functions) with respect to visibility attributes, pragmas and
options (e.g ``--fvisibility=``).
* Full register names can be used when printing assembly via ``-mregnames``.
This option now matches the one used by GCC.

.. _target_os_detail:

* ``-fdefine-target-os-macros`` and its complement
``-fno-define-target-os-macros``. Enables or disables the Clang extension to
provide built-in definitions of a list of ``TARGET_OS_*`` macros based on the
target triple.

The extension is enabled by default for Darwin (Apple platform) targets.

Deprecated Compiler Flags
-------------------------
Expand All @@ -363,6 +394,7 @@ Modified Compiler Flags
* ``-fvisibility-global-new-delete-hidden`` is now a deprecated spelling of
``-fvisibility-global-new-delete=force-hidden`` (``-fvisibility-global-new-delete=``
is new in this release).
* ``-fprofile-update`` is enabled for ``-fprofile-generate``.

Removed Compiler Flags
-------------------------
Expand Down Expand Up @@ -860,6 +892,9 @@ Bug Fixes in This Version
Fixes (`#78290 <https://github.com/llvm/llvm-project/issues/78290>`_)
- Fixed assertion failure with deleted overloaded unary operators.
Fixes (`#78314 <https://github.com/llvm/llvm-project/issues/78314>`_)
- The XCOFF object file format does not support aliases to symbols having common
linkage. Clang now diagnoses the use of an alias for a common symbol when
compiling for AIX.

- Clang now doesn't produce false-positive warning `-Wconstant-logical-operand`
for logical operators in C23.
Expand Down Expand Up @@ -1261,6 +1296,16 @@ CUDA Support
- Clang now supports CUDA SDK up to 12.3
- Added support for sm_90a

PowerPC Support
^^^^^^^^^^^^^^^

- Added ``nmmintrin.h`` to intrinsics headers.
- Added ``__builtin_ppc_fence`` as barrier of code motion, and
``__builtin_ppc_mffsl`` for corresponding instruction.
- Supported ``__attribute__((target("tune=cpu")))``.
- Emit ``float-abi`` module flag on 64-bit ELFv2 PowerPC targets if
``long double`` type is used in current module.

AIX Support
^^^^^^^^^^^

Expand All @@ -1269,6 +1314,10 @@ AIX Support
base is encoded as an immediate operand.
This access sequence is not used for TLS variables larger than 32KB, and is
currently only supported on 64-bit mode.
- Inline assembler supports VSR register in pure digits.
- Enabled ThinLTO support. Requires AIX 7.2 TL5 SP7 or newer, or AIX 7.3 TL2
or newer. Similar to the LTO support on AIX, ThinLTO is implemented with
the libLTO.so plugin.

WebAssembly Support
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1332,6 +1381,8 @@ libclang
- Exposed arguments of ``clang::annotate``.
- ``clang::getCursorKindForDecl`` now recognizes linkage specifications such as
``extern "C"`` and reports them as ``CXCursor_LinkageSpec``.
- Changed the libclang library on AIX to export only the necessary symbols to
prevent issues of resolving to the wrong duplicate symbol.

Static Analyzer
---------------
Expand All @@ -1343,9 +1394,6 @@ New features
of static analysis tools, such as the Clang Static Analyzer.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#suppress>`__.

- Added support for the ``cleanup`` attribute.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#cleanup>`__.

- Support "Deducing this" (P0847R7). (Worked out of the box)
(`af4751738db8 <https://github.com/llvm/llvm-project/commit/af4751738db89a142a8880c782d12d4201b222a8>`__)

Expand Down
12 changes: 12 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -5815,6 +5815,18 @@ def mvis3 : Flag<["-"], "mvis3">, Group<m_sparc_Features_Group>;
def mno_vis3 : Flag<["-"], "mno-vis3">, Group<m_sparc_Features_Group>;
def mhard_quad_float : Flag<["-"], "mhard-quad-float">, Group<m_sparc_Features_Group>;
def msoft_quad_float : Flag<["-"], "msoft-quad-float">, Group<m_sparc_Features_Group>;
foreach i = 1 ... 7 in
def ffixed_g#i : Flag<["-"], "ffixed-g"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the G"#i#" register (SPARC only)">;
foreach i = 0 ... 5 in
def ffixed_o#i : Flag<["-"], "ffixed-o"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the O"#i#" register (SPARC only)">;
foreach i = 0 ... 7 in
def ffixed_l#i : Flag<["-"], "ffixed-l"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the L"#i#" register (SPARC only)">;
foreach i = 0 ... 5 in
def ffixed_i#i : Flag<["-"], "ffixed-i"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the I"#i#" register (SPARC only)">;
} // let Flags = [TargetSpecific]

// M68k features flags
Expand Down
9 changes: 8 additions & 1 deletion clang/lib/Basic/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ TargetInfo::BuiltinVaListKind AArch64TargetInfo::getBuiltinVaListKind() const {
}

const char *const AArch64TargetInfo::GCCRegNames[] = {
// clang-format off

// 32-bit Integer registers
"w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", "w11",
"w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21", "w22",
Expand Down Expand Up @@ -1223,7 +1225,12 @@ const char *const AArch64TargetInfo::GCCRegNames[] = {

// SVE predicate-as-counter registers
"pn0", "pn1", "pn2", "pn3", "pn4", "pn5", "pn6", "pn7", "pn8",
"pn9", "pn10", "pn11", "pn12", "pn13", "pn14", "pn15"
"pn9", "pn10", "pn11", "pn12", "pn13", "pn14", "pn15",

// SME registers
"za", "zt0",

// clang-format on
};

ArrayRef<const char *> AArch64TargetInfo::getGCCRegNames() const {
Expand Down
81 changes: 81 additions & 0 deletions clang/lib/Driver/ToolChains/Arch/Sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,85 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args,
else
Features.push_back("-hard-quad-float");
}

if (Args.hasArg(options::OPT_ffixed_g1))
Features.push_back("+reserve-g1");

if (Args.hasArg(options::OPT_ffixed_g2))
Features.push_back("+reserve-g2");

if (Args.hasArg(options::OPT_ffixed_g3))
Features.push_back("+reserve-g3");

if (Args.hasArg(options::OPT_ffixed_g4))
Features.push_back("+reserve-g4");

if (Args.hasArg(options::OPT_ffixed_g5))
Features.push_back("+reserve-g5");

if (Args.hasArg(options::OPT_ffixed_g6))
Features.push_back("+reserve-g6");

if (Args.hasArg(options::OPT_ffixed_g7))
Features.push_back("+reserve-g7");

if (Args.hasArg(options::OPT_ffixed_o0))
Features.push_back("+reserve-o0");

if (Args.hasArg(options::OPT_ffixed_o1))
Features.push_back("+reserve-o1");

if (Args.hasArg(options::OPT_ffixed_o2))
Features.push_back("+reserve-o2");

if (Args.hasArg(options::OPT_ffixed_o3))
Features.push_back("+reserve-o3");

if (Args.hasArg(options::OPT_ffixed_o4))
Features.push_back("+reserve-o4");

if (Args.hasArg(options::OPT_ffixed_o5))
Features.push_back("+reserve-o5");

if (Args.hasArg(options::OPT_ffixed_l0))
Features.push_back("+reserve-l0");

if (Args.hasArg(options::OPT_ffixed_l1))
Features.push_back("+reserve-l1");

if (Args.hasArg(options::OPT_ffixed_l2))
Features.push_back("+reserve-l2");

if (Args.hasArg(options::OPT_ffixed_l3))
Features.push_back("+reserve-l3");

if (Args.hasArg(options::OPT_ffixed_l4))
Features.push_back("+reserve-l4");

if (Args.hasArg(options::OPT_ffixed_l5))
Features.push_back("+reserve-l5");

if (Args.hasArg(options::OPT_ffixed_l6))
Features.push_back("+reserve-l6");

if (Args.hasArg(options::OPT_ffixed_l7))
Features.push_back("+reserve-l7");

if (Args.hasArg(options::OPT_ffixed_i0))
Features.push_back("+reserve-i0");

if (Args.hasArg(options::OPT_ffixed_i1))
Features.push_back("+reserve-i1");

if (Args.hasArg(options::OPT_ffixed_i2))
Features.push_back("+reserve-i2");

if (Args.hasArg(options::OPT_ffixed_i3))
Features.push_back("+reserve-i3");

if (Args.hasArg(options::OPT_ffixed_i4))
Features.push_back("+reserve-i4");

if (Args.hasArg(options::OPT_ffixed_i5))
Features.push_back("+reserve-i5");
}
2 changes: 1 addition & 1 deletion clang/lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,7 +2515,7 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) {
parseChildBlock();
break;
case tok::r_paren:
if (!MightBeStmtExpr &&
if (!MightBeStmtExpr && !Line->InMacroBody &&
Style.RemoveParentheses > FormatStyle::RPS_Leave) {
const auto *Prev = LeftParen->Previous;
const auto *Next = Tokens->peekNextToken();
Expand Down
10 changes: 7 additions & 3 deletions clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,12 @@ void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
BitsUnpacker EnumDeclBits(Record.readInt());
ED->setNumPositiveBits(EnumDeclBits.getNextBits(/*Width=*/8));
ED->setNumNegativeBits(EnumDeclBits.getNextBits(/*Width=*/8));
bool ShouldSkipCheckingODR = EnumDeclBits.getNextBit();
ED->setScoped(EnumDeclBits.getNextBit());
ED->setScopedUsingClassTag(EnumDeclBits.getNextBit());
ED->setFixed(EnumDeclBits.getNextBit());

if (!shouldSkipCheckingODR(ED)) {
if (!ShouldSkipCheckingODR) {
ED->setHasODRHash(true);
ED->ODRHash = Record.readInt();
}
Expand Down Expand Up @@ -1073,6 +1074,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {

FD->setCachedLinkage((Linkage)FunctionDeclBits.getNextBits(/*Width=*/3));
FD->setStorageClass((StorageClass)FunctionDeclBits.getNextBits(/*Width=*/3));
bool ShouldSkipCheckingODR = FunctionDeclBits.getNextBit();
FD->setInlineSpecified(FunctionDeclBits.getNextBit());
FD->setImplicitlyInline(FunctionDeclBits.getNextBit());
FD->setHasSkippedBody(FunctionDeclBits.getNextBit());
Expand Down Expand Up @@ -1102,7 +1104,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
if (FD->isExplicitlyDefaulted())
FD->setDefaultLoc(readSourceLocation());

if (!shouldSkipCheckingODR(FD)) {
if (!ShouldSkipCheckingODR) {
FD->ODRHash = Record.readInt();
FD->setHasODRHash(true);
}
Expand Down Expand Up @@ -1973,6 +1975,8 @@ void ASTDeclReader::ReadCXXDefinitionData(

BitsUnpacker CXXRecordDeclBits = Record.readInt();

bool ShouldSkipCheckingODR = CXXRecordDeclBits.getNextBit();

#define FIELD(Name, Width, Merge) \
if (!CXXRecordDeclBits.canGetNextNBits(Width)) \
CXXRecordDeclBits.updateValue(Record.readInt()); \
Expand All @@ -1982,7 +1986,7 @@ void ASTDeclReader::ReadCXXDefinitionData(
#undef FIELD

// We only perform ODR checks for decls not in GMF.
if (!shouldSkipCheckingODR(D)) {
if (!ShouldSkipCheckingODR) {
// Note: the caller has deserialized the IsLambda bit already.
Data.ODRHash = Record.readInt();
Data.HasODRHash = true;
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6010,6 +6010,9 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {

BitsPacker DefinitionBits;

bool ShouldSkipCheckingODR = shouldSkipCheckingODR(D);
DefinitionBits.addBit(ShouldSkipCheckingODR);

#define FIELD(Name, Width, Merge) \
if (!DefinitionBits.canWriteNextNBits(Width)) { \
Record->push_back(DefinitionBits); \
Expand All @@ -6023,11 +6026,10 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
Record->push_back(DefinitionBits);

// We only perform ODR checks for decls not in GMF.
if (!shouldSkipCheckingODR(D)) {
if (!ShouldSkipCheckingODR)
// getODRHash will compute the ODRHash if it has not been previously
// computed.
Record->push_back(D->getODRHash());
}

bool ModulesDebugInfo =
Writer->Context->getLangOpts().ModulesDebugInfo && !D->isDependentType();
Expand Down
Loading

0 comments on commit 3e722cc

Please sign in to comment.