Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-doc][cmake] Copy assets to build directory #95185

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .ci/generate-buildkite-pipeline-premerge
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ function exclude-linux() {
for project in ${projects}; do
case ${project} in
cross-project-tests) ;; # tests failing
lldb) ;; # tests failing
openmp) ;; # https://github.com/google/llvm-premerge-checks/issues/410
*)
echo "${project}"
Expand All @@ -170,7 +169,7 @@ function exclude-windows() {
compiler-rt) ;; # tests taking too long
openmp) ;; # TODO: having trouble with the Perl installation
libc) ;; # no Windows support
lldb) ;; # tests failing
lldb) ;; # custom environment requirements (https://github.com/llvm/llvm-project/pull/94208#issuecomment-2146256857)
bolt) ;; # tests are not supported yet
*)
echo "${project}"
Expand Down Expand Up @@ -213,7 +212,7 @@ function check-targets() {
echo "check-unwind"
;;
lldb)
echo "check-all" # TODO: check-lldb may not include all the LLDB tests?
echo "check-lldb"
;;
pstl)
echo "check-all"
Expand Down
1 change: 1 addition & 0 deletions .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ targets="${2}"

echo "--- cmake"
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ci-post-commit-analyzer-run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import json
import multiprocessing
import os
import re
import subprocess
import sys


def run_analyzer(data):
os.chdir(data["directory"])
command = (
data["command"]
+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
)
print(command)
subprocess.run(command, shell=True, check=True)


def pool_error(e):
print("Error analyzing file:", e)


def main():
db_path = sys.argv[1]
database = json.load(open(db_path))

with multiprocessing.Pool() as pool:
pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
pool.close()
pool.join()


if __name__ == "__main__":
main()
95 changes: 95 additions & 0 deletions .github/workflows/ci-post-commit-analyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Post-Commit Static Analyzer

permissions:
contents: read

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- '.github/workflows/ci-post-commit-analyzer.yml'
pull_request:
types:
- opened
- synchronize
- reopened
- closed
paths:
- '.github/workflows/ci-post-commit-analyzer.yml'
- '.github/workflows/ci-post-commit-analyzer-run.py'
schedule:
- cron: '30 0 * * *'

concurrency:
group: >-
llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
( github.event.pull_request.number || github.ref) }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
post-commit-analyzer:
if: >-
github.repository_owner == 'llvm' &&
github.event.action != 'closed'
runs-on: ubuntu-22.04
container:
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
env:
LLVM_VERSION: 18
steps:
- name: Checkout Source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
# A full build of llvm, clang, lld, and lldb takes about 250MB
# of ccache space. There's not much reason to have more than this,
# because we usually won't need to save cache entries from older
# builds. Also, there is an overall 10GB cache limit, and each
# run creates a new cache entry so we want to ensure that we have
# enough cache space for all the tests to run at once and still
# fit under the 10 GB limit.
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
max-size: 2G
key: post-commit-analyzer
variant: sccache

- name: Configure
run: |
cmake -B build -S llvm -G Ninja \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release

- name: Build
run: |
# FIXME: We need to build all the generated header files in order to be able to run
# the analyzer on every file. Building libLLVM and libclang is probably overkill for
# this, but it's better than building every target.
ninja -v -C build libLLVM.so libclang.so

# Run the analyzer.
python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json

scan-build --generate-index-only build/analyzer-results

- name: Upload Results
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
if: always()
with:
name: analyzer-results
path: 'build/analyzer-results/*'

2 changes: 1 addition & 1 deletion .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:

- id: package-info
run: |
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.xz"
echo "filename=$filename" >> $GITHUB_OUTPUT
echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT

Expand Down
10 changes: 2 additions & 8 deletions bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1706,12 +1706,9 @@ class MCPlusBuilder {
}

/// Reverses the branch condition in Inst and update its taken target to TBB.
///
/// Returns true on success.
virtual bool reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
virtual void reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
MCContext *Ctx) const {
llvm_unreachable("not implemented");
return false;
}

virtual bool replaceBranchCondition(MCInst &Inst, const MCSymbol *TBB,
Expand Down Expand Up @@ -1751,12 +1748,9 @@ class MCPlusBuilder {
}

/// Sets the taken target of the branch instruction to Target.
///
/// Returns true on success.
virtual bool replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
virtual void replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
MCContext *Ctx) const {
llvm_unreachable("not implemented");
return false;
}

/// Extract a symbol and an addend out of the fixup value expression.
Expand Down
4 changes: 3 additions & 1 deletion bolt/include/bolt/Rewrite/DWARFRewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "bolt/Core/DIEBuilder.h"
#include "bolt/Core/DebugData.h"
#include "bolt/Core/DebugNames.h"
#include "bolt/Core/GDBIndex.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/DWP/DWP.h"
Expand Down Expand Up @@ -131,7 +132,8 @@ class DWARFRewriter {
makeFinalLocListsSection(DWARFVersion Version);

/// Finalize type sections in the main binary.
CUOffsetMap finalizeTypeSections(DIEBuilder &DIEBlder, DIEStreamer &Streamer);
CUOffsetMap finalizeTypeSections(DIEBuilder &DIEBlder, DIEStreamer &Streamer,
GDBIndex &GDBIndexSection);

/// Process and write out CUs that are passsed in.
void finalizeCompileUnits(DIEBuilder &DIEBlder, DIEStreamer &Streamer,
Expand Down
2 changes: 2 additions & 0 deletions bolt/lib/Core/BinaryEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class BinaryEmitter {

void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
Streamer.initSections(false, *BC.STI);
Streamer.setUseAssemblerInfoForParsing(false);

if (opts::UpdateDebugSections && BC.isELF()) {
// Force the emission of debug line info into allocatable section to ensure
Expand Down Expand Up @@ -226,6 +227,7 @@ void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
// TODO Enable for Mach-O once BinaryContext::getDataSection supports it.
if (BC.isELF())
AddressMap::emit(Streamer, BC);
Streamer.setUseAssemblerInfoForParsing(true);
}

void BinaryEmitter::emitFunctions() {
Expand Down
7 changes: 2 additions & 5 deletions bolt/lib/Passes/VeneerElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ Error VeneerElimination::runOnFunctions(BinaryContext &BC) {
continue;

VeneerCallers++;
if (!BC.MIB->replaceBranchTarget(
Instr, VeneerDestinations[TargetSymbol], BC.Ctx.get())) {
return createFatalBOLTError(
"BOLT-ERROR: updating veneer call destination failed\n");
}
BC.MIB->replaceBranchTarget(Instr, VeneerDestinations[TargetSymbol],
BC.Ctx.get());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Profile/BoltAddressTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ std::error_code BoltAddressTranslation::parse(raw_ostream &OS, StringRef Buf) {

StringRef Name = Buf.slice(Offset, Offset + NameSz);
Offset = alignTo(Offset + NameSz, 4);
if (Name.substr(0, 4) != "BOLT")
if (!Name.starts_with("BOLT"))
return make_error_code(llvm::errc::io_error);

Error Err(Error::success());
Expand Down
Loading
Loading