Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into users/mizvekov/clang-…
Browse files Browse the repository at this point in the history
…cwg2398-ttp-matches-class-template
  • Loading branch information
mizvekov committed Sep 5, 2024
2 parents 2729c98 + c28b1a1 commit 530f884
Show file tree
Hide file tree
Showing 3,514 changed files with 365,080 additions and 451,682 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .github/workflows/pr-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
jobs:
code_formatter:
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
if: github.repository == 'llvm/llvm-project'
steps:
- name: Fetch LLVM sources
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-binaries-save-stage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
required: true
type: 'string'

permissions:
contents: read

runs:
using: "composite"
steps:
Expand All @@ -18,6 +21,9 @@ runs:
- name: Package Build and Source Directories
shell: bash
run: |
# Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
# See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
rm -Rf .git/config
# Windows does not support symlinks, so we need to dereference them.
tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
mv ../llvm-project.tar.zst .
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,8 @@ jobs:
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
fi
# x86 macOS and x86 Windows have trouble building flang, so disable it.
# Windows: https://github.com/llvm/llvm-project/issues/100202
# macOS: 'rebase opcodes terminated early at offset 1 of 80016' when building __fortran_builtins.mod
build_flang="true"
if [ "$target" = "Windows-X64" ]; then
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS=\"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir\""
build_flang="false"
fi
if [ "${{ runner.os }}" = "Windows" ]; then
# The build times out on Windows, so we need to disable LTO.
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release-doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ on:
description: 'Upload documentation'
required: false
type: boolean
secrets:
RELEASE_TASKS_USER_TOKEN:
description: "Secret used to check user permissions."
required: false

jobs:
release-doxygen:
Expand Down Expand Up @@ -63,5 +67,6 @@ jobs:
if: env.upload
env:
GITHUB_TOKEN: ${{ github.token }}
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
run: |
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" --user-token "$USER_TOKEN" upload --files ./*doxygen*.tar.xz
7 changes: 6 additions & 1 deletion .github/workflows/release-lit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
description: 'Release Version'
required: true
type: string
secrets:
RELEASE_TASKS_USER_TOKEN:
description: "Secret used to check user permissions."
required: false

jobs:
release-lit:
Expand All @@ -36,8 +40,9 @@ jobs:
- name: Check Permissions
env:
GITHUB_TOKEN: ${{ github.token }}
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
- name: Setup Cpp
uses: aminya/setup-cpp@v1
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
description: Release Version
required: true
type: string
secrets:
RELEASE_TASKS_USER_TOKEN:
description: "Secret used to check user permissions."
required: false
# Run on pull_requests for testing purposes.
pull_request:
paths:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ jobs:
with:
release-version: ${{ needs.validate-tag.outputs.release-version }}
upload: true
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
secrets:
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

release-lit:
name: Release Lit
needs: validate-tag
uses: ./.github/workflows/release-lit.yml
with:
release-version: ${{ needs.validate-tag.outputs.release-version }}
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
secrets:
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

release-binaries:
name: Build Release Binaries
Expand All @@ -97,6 +103,9 @@ jobs:
release-version: ${{ needs.validate-tag.outputs.release-version }}
upload: true
runs-on: ${{ matrix.runs-on }}
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
secrets:
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

release-sources:
name: Package Release Sources
Expand All @@ -109,3 +118,6 @@ jobs:
uses: ./.github/workflows/release-sources.yml
with:
release-version: ${{ needs.validate-tag.outputs.release-version }}
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
secrets:
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
1 change: 1 addition & 0 deletions bolt/lib/Profile/YAMLProfileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
return errorCodeToError(EC);
}
yaml::Input YamlInput(MB.get()->getBuffer());
YamlInput.setAllowUnknownKeys(true);

// Consume YAML file.
YamlInput >> YamlBP;
Expand Down
50 changes: 50 additions & 0 deletions bolt/test/X86/yaml-unknown-keys.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Test that BOLT gracefully handles a YAML profile with unknown keys.

# REQUIRES: system-linux
# RUN: split-file %s %t
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
# RUN: llvm-bolt %t.exe -o %t.null --data %t/profile.yaml \
# RUN: --profile-ignore-hash -v=1 2>&1 | FileCheck %s
# CHECK: warning: unknown key 'unknown-header-key'
# CHECK: warning: unknown key 'unknown_succ_key'
# CHECK: warning: unknown key 'unknown_block_key'
# CHECK: warning: unknown key 'unknown_function_key'
# CHECK: warning: unknown key 'unknown_toplev_key'
#--- main.s
.globl main
.type main, %function
main:
.cfi_startproc
cmpl $0x0, %eax
jne .LBB0
.LBB0:
retq
.cfi_endproc
.size main, .-main
#--- profile.yaml
---
header:
profile-version: 1
binary-name: 'yaml-multiple-profiles.test.tmp.exe'
binary-build-id: '<unknown>'
profile-flags: [ lbr ]
profile-origin: branch profile reader
profile-events: ''
dfs-order: false
unknown-header-key: true
functions:
- name: 'main'
fid: 1
hash: 0x50BBA3441D436491
exec: 1
nblocks: 1
blocks:
- bid: 0
insns: 2
hash: 0x4D4D8FAF7D4C0000
succ: [ { bid: 1, cnt: 0, unknown_succ_key: 0x10 } ]
unknown_block_key: [ ]
unknown_function_key: 1
unknown_toplev_key: ''
...
1 change: 1 addition & 0 deletions bolt/tools/merge-fdata/merge-fdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ int main(int argc, char **argv) {
if (std::error_code EC = MB.getError())
report_error(InputDataFilename, EC);
yaml::Input YamlInput(MB.get()->getBuffer());
YamlInput.setAllowUnknownKeys(true);

errs() << "Merging data from " << InputDataFilename << "...\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ void CastingThroughVoidCheck::check(const MatchFinder::MatchResult &Result) {
const auto ST = *Result.Nodes.getNodeAs<QualType>("source_type");
const auto VT = *Result.Nodes.getNodeAs<QualType>("void_type");
const auto *CE = Result.Nodes.getNodeAs<ExplicitCastExpr>("cast");
diag(CE->getExprLoc(), "do not cast %0 to %1 through %2") << ST << TT << VT;
diag(CE->getExprLoc(),
"do not cast %0 to %1 through %2; use reinterpret_cast instead")
<< ST << TT << VT;
}

} // namespace clang::tidy::bugprone
10 changes: 4 additions & 6 deletions clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,10 @@ async def main() -> None:
)
invocation.append("-list-checks")
invocation.append("-")
if args.quiet:
# Even with -quiet we still want to check if we can call clang-tidy.
with open(os.devnull, "w") as dev_null:
subprocess.check_call(invocation, stdout=dev_null)
else:
subprocess.check_call(invocation)
# Even with -quiet we still want to check if we can call clang-tidy.
subprocess.check_call(
invocation, stdout=subprocess.DEVNULL if args.quiet else None
)
except:
print("Unable to run clang-tidy.", file=sys.stderr)
sys.exit(1)
Expand Down
1 change: 1 addition & 0 deletions clang-tools-extra/clangd/CollectMacros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,
if (Loc.isInvalid() || Loc.isMacroID())
return;

assert(isInsideMainFile(Loc, SM));
auto Name = MacroNameTok.getIdentifierInfo()->getName();
Out.Names.insert(Name);
size_t Start = SM.getFileOffset(Loc);
Expand Down
8 changes: 8 additions & 0 deletions clang-tools-extra/clangd/CollectMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ class CollectMainFileMacros : public PPCallbacks {

void SourceRangeSkipped(SourceRange R, SourceLocation EndifLoc) override;

// Called when the AST build is done to disable further recording
// of macros by this class. This is needed because some clang-tidy
// checks can trigger PP callbacks by calling directly into the
// preprocessor. Such calls are not interleaved with FileChanged()
// in the expected way, leading this class to erroneously process
// macros that are not in the main file.
void doneParse() { InMainFile = false; }

private:
void add(const Token &MacroNameTok, const MacroInfo *MI,
bool IsDefinition = false, bool InConditionalDirective = false);
Expand Down
Loading

0 comments on commit 530f884

Please sign in to comment.