Skip to content

Commit cd7c0be

Browse files
committed
rebase
Created using spr 1.3.4
2 parents 3362e99 + a867b62 commit cd7c0be

File tree

2,697 files changed

+99859
-40149
lines changed

Some content is hidden

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

2,697 files changed

+99859
-40149
lines changed

.ci/monolithic-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4545
-D LLVM_ENABLE_ASSERTIONS=ON \
4646
-D LLVM_BUILD_EXAMPLES=ON \
4747
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
48-
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
48+
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
4949
-D LLVM_ENABLE_LLD=ON \
5050
-D CMAKE_CXX_FLAGS=-gmlt \
5151
-D BOLT_CLANG_EXE=/usr/bin/clang \

.ci/monolithic-windows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4545
-D LLVM_ENABLE_ASSERTIONS=ON \
4646
-D LLVM_BUILD_EXAMPLES=ON \
4747
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
48-
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
48+
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
4949
-D COMPILER_RT_BUILD_ORC=OFF \
5050
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
5151
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
name: Build CI Container
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- .github/workflows/build-ci-container.yml
13+
- '.github/workflows/containers/github-action-ci/**'
14+
pull_request:
15+
branches:
16+
- main
17+
paths:
18+
- .github/workflows/build-ci-container.yml
19+
- '.github/workflows/containers/github-action-ci/**'
20+
21+
jobs:
22+
build-ci-container:
23+
if: github.repository_owner == 'llvm'
24+
runs-on: ubuntu-latest
25+
permissions:
26+
packages: write
27+
steps:
28+
- name: Write Variables
29+
id: vars
30+
run: |
31+
tag=`date +%s`
32+
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
33+
echo "container-name=$container_name" >> $GITHUB_OUTPUT
34+
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
35+
36+
- name: Checkout LLVM
37+
uses: actions/checkout@v4
38+
with:
39+
sparse-checkout: .github/workflows/containers/github-action-ci/
40+
41+
- name: Build Container
42+
working-directory: ./.github/workflows/containers/github-action-ci/
43+
run: |
44+
podman build -t ${{ steps.vars.outputs.container-name-tag }} .
45+
podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
46+
47+
- name: Test Container
48+
run: |
49+
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
50+
podman run --rm -it $image /usr/bin/bash -x -c 'printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
51+
done
52+
53+
- name: Push Container
54+
if: github.event_name == 'push'
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
59+
podman push ${{ steps.vars.outputs.container-name-tag }}
60+
podman push ${{ steps.vars.outputs.container-name }}:latest
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM docker.io/library/ubuntu:22.04 as base
2+
ENV LLVM_SYSROOT=/opt/llvm/
3+
4+
FROM base as toolchain
5+
ENV LLVM_MAJOR=17
6+
ENV LLVM_VERSION=${LLVM_MAJOR}.0.6
7+
ENV LLVM_DIRNAME=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-22.04
8+
ENV LLVM_FILENAME=${LLVM_DIRNAME}.tar.xz
9+
10+
RUN apt-get update && \
11+
apt-get install -y \
12+
curl \
13+
xz-utils
14+
15+
RUN mkdir -p $LLVM_SYSROOT/bin/ $LLVM_SYSROOT/lib/
16+
17+
RUN curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_FILENAME
18+
19+
RUN tar -C $LLVM_SYSROOT --strip-components=1 -xJf $LLVM_FILENAME \
20+
$LLVM_DIRNAME/bin/clang \
21+
$LLVM_DIRNAME/bin/clang++ \
22+
$LLVM_DIRNAME/bin/clang-cl \
23+
$LLVM_DIRNAME/bin/clang-$LLVM_MAJOR \
24+
$LLVM_DIRNAME/bin/lld \
25+
$LLVM_DIRNAME/bin/ld.lld \
26+
$LLVM_DIRNAME/lib/clang/
27+
28+
29+
FROM base
30+
31+
COPY --from=toolchain $LLVM_SYSROOT $LLVM_SYSROOT
32+
33+
# Need to install curl for hendrikmuhs/ccache-action
34+
# Need nodejs for some of the GitHub actions.
35+
# Need perl-modules for clang analyzer tests.
36+
RUN apt-get update && \
37+
apt-get install -y \
38+
binutils \
39+
cmake \
40+
curl \
41+
libstdc++-11-dev \
42+
ninja-build \
43+
nodejs \
44+
perl-modules \
45+
python3-psutil
46+
47+
ENV LLVM_SYSROOT=$LLVM_SYSROOT
48+
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Libclang Python Binding Tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
paths:
10+
- 'clang/bindings/python/**'
11+
- 'clang/tools/libclang/**'
12+
- 'clang/CMakeList.txt'
13+
- '.github/workflows/libclang-python-tests.yml'
14+
- '.github/workflows/llvm-project-tests.yml'
15+
pull_request:
16+
paths:
17+
- 'clang/bindings/python/**'
18+
- 'clang/tools/libclang/**'
19+
- 'clang/CMakeList.txt'
20+
- '.github/workflows/libclang-python-tests.yml'
21+
- '.github/workflows/llvm-project-tests.yml'
22+
23+
concurrency:
24+
# Skip intermediate builds: always.
25+
# Cancel intermediate builds: only if it is a pull request build.
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
28+
29+
jobs:
30+
check-clang-python:
31+
# Build libclang and then run the libclang Python binding's unit tests.
32+
name: Build and run Python unit tests
33+
uses: ./.github/workflows/llvm-project-tests.yml
34+
with:
35+
build_target: check-clang-python
36+
projects: clang
37+
# There is an issue running on "windows-2019".
38+
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
39+
os_list: '["ubuntu-latest"]'

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ jobs:
161161
'generic-no-unicode',
162162
'generic-no-wide-characters',
163163
'generic-no-rtti',
164+
'generic-optimized-speed',
164165
'generic-static',
165-
'generic-with_llvm_unwinder',
166166
# TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive
167167
# or don't provide much value since the benchmark run results are too noise on the bots.
168168
'benchmarks',

.github/workflows/llvm-project-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
# enough cache space for all the tests to run at once and still
8888
# fit under the 10 GB limit.
8989
max-size: 500M
90-
key: sccache-${{ matrix.os }}
90+
key: ${{ matrix.os }}
9191
variant: sccache
9292
- name: Build and Test
9393
uses: llvm/actions/build-test-llvm-project@main

.github/workflows/release-binaries.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ jobs:
9393

9494
- name: Build Clang
9595
run: |
96-
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_ENABLE_ASSERTIONS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLLVM_ENABLE_PROJECTS=clang -S llvm -B build
97-
ninja -v -C build
96+
cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_POSITION_INDEPENDENT_CODE=ON -S llvm -B build
97+
ninja -v -C build clang
9898
9999
100100
build-binaries:
@@ -152,6 +152,7 @@ jobs:
152152
-triple ${{ matrix.target.triple }} \
153153
-use-ninja \
154154
-no-checkout \
155+
-use-cmake-cache \
155156
-no-test-suite \
156157
-configure-flags "-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
157158

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# The LLVM Compiler Infrastructure
22

33
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/llvm/llvm-project/badge)](https://securityscorecards.dev/viewer/?uri=github.com/llvm/llvm-project)
4+
[![libc++](https://github.com/llvm/llvm-project/actions/workflows/libcxx-build-and-test.yaml/badge.svg?branch=main&event=schedule)](https://github.com/llvm/llvm-project/actions/workflows/libcxx-build-and-test.yaml?query=event%3Aschedule)
45

56
Welcome to the LLVM project!
67

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,46 +2351,46 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23512351
YamlBB.Hash = Hash;
23522352
YamlBB.Index = BlockMap.at(Offset).first;
23532353
const auto &SuccBlockIt = Branches.IntraIndex.find(Offset);
2354-
if (SuccBlockIt != Branches.IntraIndex.end()) {
2355-
uint64_t TotalCount{0};
2356-
for (const auto &[SuccOffset, SuccIdx] : SuccBlockIt->second) {
2357-
unsigned SuccBid = BlockMap.at(SuccOffset).first;
2358-
const llvm::bolt::BranchInfo &BI = Branches.Data.at(SuccIdx);
2359-
yaml::bolt::SuccessorInfo YamlSI;
2360-
YamlSI.Index = SuccBid;
2361-
YamlSI.Count = BI.Branches;
2362-
YamlSI.Mispreds = BI.Mispreds;
2363-
YamlBB.Successors.emplace_back(YamlSI);
2364-
TotalCount += YamlSI.Count;
2365-
}
2366-
YamlBB.ExecCount = TotalCount;
2354+
if (SuccBlockIt == Branches.IntraIndex.end())
2355+
continue;
2356+
uint64_t TotalCount{0};
2357+
for (const auto &[SuccOffset, SuccIdx] : SuccBlockIt->second) {
2358+
unsigned SuccBid = BlockMap.at(SuccOffset).first;
2359+
const llvm::bolt::BranchInfo &BI = Branches.Data.at(SuccIdx);
2360+
yaml::bolt::SuccessorInfo YamlSI;
2361+
YamlSI.Index = SuccBid;
2362+
YamlSI.Count = BI.Branches;
2363+
YamlSI.Mispreds = BI.Mispreds;
2364+
YamlBB.Successors.emplace_back(YamlSI);
2365+
TotalCount += YamlSI.Count;
23672366
}
2367+
YamlBB.ExecCount = TotalCount;
23682368
// Iterate over BRANCHENTRY records in the current block
23692369
for (uint32_t BranchOffset : BFBranches[Offset]) {
23702370
const auto &CallToIt = Branches.InterIndex.find(BranchOffset);
2371-
if (CallToIt != Branches.InterIndex.end()) {
2372-
for (const auto &[CallToLoc, CallToIdx] : CallToIt->second) {
2373-
const llvm::bolt::BranchInfo &BI = Branches.Data.at(CallToIdx);
2374-
yaml::bolt::CallSiteInfo YamlCSI;
2375-
YamlCSI.DestId = 0; // designated for unknown functions
2376-
YamlCSI.EntryDiscriminator = 0;
2377-
YamlCSI.Count = BI.Branches;
2378-
YamlCSI.Mispreds = BI.Mispreds;
2379-
YamlCSI.Offset = BranchOffset - Offset;
2380-
BinaryData *CallTargetBD = BC.getBinaryDataByName(CallToLoc.Name);
2381-
if (!CallTargetBD) {
2382-
YamlBB.CallSites.emplace_back(YamlCSI);
2383-
continue;
2384-
}
2385-
BinaryFunction *CallTargetBF =
2386-
BC.getBinaryFunctionAtAddress(CallTargetBD->getAddress());
2387-
if (!CallTargetBF) {
2388-
YamlBB.CallSites.emplace_back(YamlCSI);
2389-
continue;
2390-
}
2391-
YamlCSI.DestId = CallTargetBF->getFunctionNumber();
2371+
if (CallToIt == Branches.InterIndex.end())
2372+
continue;
2373+
for (const auto &[CallToLoc, CallToIdx] : CallToIt->second) {
2374+
const llvm::bolt::BranchInfo &BI = Branches.Data.at(CallToIdx);
2375+
yaml::bolt::CallSiteInfo YamlCSI;
2376+
YamlCSI.DestId = 0; // designated for unknown functions
2377+
YamlCSI.EntryDiscriminator = 0;
2378+
YamlCSI.Count = BI.Branches;
2379+
YamlCSI.Mispreds = BI.Mispreds;
2380+
YamlCSI.Offset = BranchOffset - Offset;
2381+
BinaryData *CallTargetBD = BC.getBinaryDataByName(CallToLoc.Name);
2382+
if (!CallTargetBD) {
2383+
YamlBB.CallSites.emplace_back(YamlCSI);
2384+
continue;
2385+
}
2386+
BinaryFunction *CallTargetBF =
2387+
BC.getBinaryFunctionAtAddress(CallTargetBD->getAddress());
2388+
if (!CallTargetBF) {
23922389
YamlBB.CallSites.emplace_back(YamlCSI);
2390+
continue;
23932391
}
2392+
YamlCSI.DestId = CallTargetBF->getFunctionNumber();
2393+
YamlBB.CallSites.emplace_back(YamlCSI);
23942394
}
23952395
}
23962396
if (YamlBB.ExecCount || !YamlBB.Successors.empty() ||

bolt/lib/Rewrite/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
MC
66
Object
77
Support
8+
DWARFLinkerBase
89
DWARFLinker
910
AsmPrinter
1011
TargetParser

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "llvm/BinaryFormat/Dwarf.h"
2222
#include "llvm/CodeGen/AsmPrinter.h"
2323
#include "llvm/CodeGen/DIE.h"
24-
#include "llvm/DWARFLinker/DWARFStreamer.h"
24+
#include "llvm/DWARFLinker/Classic/DWARFStreamer.h"
2525
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2626
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
2727
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
@@ -178,6 +178,9 @@ translateInputToOutputLocationList(const BinaryFunction &BF,
178178
return MergedLL;
179179
}
180180

181+
using namespace dwarf_linker;
182+
using namespace dwarf_linker::classic;
183+
181184
namespace llvm {
182185
namespace bolt {
183186
/// Emits debug information into .debug_info or .debug_types section.
@@ -278,10 +281,10 @@ class DIEStreamer : public DwarfStreamer {
278281

279282
public:
280283
DIEStreamer(DIEBuilder *DIEBldr, DWARFRewriter &Rewriter,
281-
DWARFLinker::OutputFileType OutFileType,
284+
DWARFLinkerBase::OutputFileType OutFileType,
282285
raw_pwrite_stream &OutFile,
283286
std::function<StringRef(StringRef Input)> Translator,
284-
DWARFLinker::messageHandler Warning)
287+
DWARFLinkerBase::MessageHandlerTy Warning)
285288
: DwarfStreamer(OutFileType, OutFile, Translator, Warning),
286289
DIEBldr(DIEBldr), Rewriter(Rewriter){};
287290

@@ -457,7 +460,7 @@ createDIEStreamer(const Triple &TheTriple, raw_pwrite_stream &OutFile,
457460
DWARFRewriter &Rewriter) {
458461

459462
std::unique_ptr<DIEStreamer> Streamer = std::make_unique<DIEStreamer>(
460-
&DIEBldr, Rewriter, llvm::DWARFLinker::OutputFileType::Object, OutFile,
463+
&DIEBldr, Rewriter, DWARFLinkerBase::OutputFileType::Object, OutFile,
461464
[](StringRef Input) -> StringRef { return Input; },
462465
[&](const Twine &Warning, StringRef Context, const DWARFDie *) {});
463466
Error Err = Streamer->init(TheTriple, Swift5ReflectionSegmentName);

bolt/lib/Rewrite/JITLinkLinker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ struct JITLinkLinker::Context : jitlink::JITLinkContext {
173173

174174
void notifyFinalized(
175175
jitlink::JITLinkMemoryManager::FinalizedAlloc Alloc) override {
176-
Linker.Allocs.push_back(std::move(Alloc));
176+
if (Alloc)
177+
Linker.Allocs.push_back(std::move(Alloc));
177178
++Linker.MM->ObjectsLoaded;
178179
}
179180
};

bolt/test/RISCV/relax.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// CHECK: Binary Function "_start" after building cfg {
88
// CHECK: jal ra, near_f
9-
// CHECK-NEXT: auipc ra, far_f@plt
9+
// CHECK-NEXT: auipc ra, far_f
1010
// CHECK-NEXT: jalr ra, 0xc(ra)
1111
// CHECK-NEXT: j near_f
1212

clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
;;; clang-include-fixer.el --- Emacs integration of the clang include fixer -*- lexical-binding: t; -*-
22

3+
;; Version: 0.1.0
34
;; Keywords: tools, c
45
;; Package-Requires: ((cl-lib "0.5") (json "1.2") (let-alist "1.0.4"))
56

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ namespace query {
2828
// is found before End, return StringRef(). Begin is adjusted to exclude the
2929
// lexed region.
3030
StringRef QueryParser::lexWord() {
31-
Line = Line.drop_while([](char c) {
32-
// Don't trim newlines.
33-
return StringRef(" \t\v\f\r").contains(c);
34-
});
31+
// Don't trim newlines.
32+
Line = Line.ltrim(" \t\v\f\r");
3533

3634
if (Line.empty())
3735
// Even though the Line is empty, it contains a pointer and
@@ -152,8 +150,7 @@ QueryRef QueryParser::parseSetTraversalKind(TraversalKind QuerySession::*Var) {
152150

153151
QueryRef QueryParser::endQuery(QueryRef Q) {
154152
StringRef Extra = Line;
155-
StringRef ExtraTrimmed = Extra.drop_while(
156-
[](char c) { return StringRef(" \t\v\f\r").contains(c); });
153+
StringRef ExtraTrimmed = Extra.ltrim(" \t\v\f\r");
157154

158155
if ((!ExtraTrimmed.empty() && ExtraTrimmed[0] == '\n') ||
159156
(ExtraTrimmed.size() >= 2 && ExtraTrimmed[0] == '\r' &&

0 commit comments

Comments
 (0)