Skip to content

Commit 530f884

Browse files
committed
Merge remote-tracking branch 'origin/main' into users/mizvekov/clang-cwg2398-ttp-matches-class-template
2 parents 2729c98 + c28b1a1 commit 530f884

File tree

3,514 files changed

+365080
-451682
lines changed

Some content is hidden

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

3,514 files changed

+365080
-451682
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
jobs:
1313
code_formatter:
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
18+
cancel-in-progress: true
1519
if: github.repository == 'llvm/llvm-project'
1620
steps:
1721
- name: Fetch LLVM sources

.github/workflows/release-binaries-save-stage/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
required: true
1111
type: 'string'
1212

13+
permissions:
14+
contents: read
15+
1316
runs:
1417
using: "composite"
1518
steps:
@@ -18,6 +21,9 @@ runs:
1821
- name: Package Build and Source Directories
1922
shell: bash
2023
run: |
24+
# Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
25+
# See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
26+
rm -Rf .git/config
2127
# Windows does not support symlinks, so we need to dereference them.
2228
tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
2329
mv ../llvm-project.tar.zst .

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,8 @@ jobs:
135135
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
136136
fi
137137
138-
# x86 macOS and x86 Windows have trouble building flang, so disable it.
139-
# Windows: https://github.com/llvm/llvm-project/issues/100202
140-
# macOS: 'rebase opcodes terminated early at offset 1 of 80016' when building __fortran_builtins.mod
141138
build_flang="true"
142139
143-
if [ "$target" = "Windows-X64" ]; then
144-
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS=\"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir\""
145-
build_flang="false"
146-
fi
147-
148140
if [ "${{ runner.os }}" = "Windows" ]; then
149141
# The build times out on Windows, so we need to disable LTO.
150142
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"

.github/workflows/release-doxygen.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
description: 'Upload documentation'
2626
required: false
2727
type: boolean
28+
secrets:
29+
RELEASE_TASKS_USER_TOKEN:
30+
description: "Secret used to check user permissions."
31+
required: false
2832

2933
jobs:
3034
release-doxygen:
@@ -63,5 +67,6 @@ jobs:
6367
if: env.upload
6468
env:
6569
GITHUB_TOKEN: ${{ github.token }}
70+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
6671
run: |
67-
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz
72+
./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

.github/workflows/release-lit.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
description: 'Release Version'
1818
required: true
1919
type: string
20+
secrets:
21+
RELEASE_TASKS_USER_TOKEN:
22+
description: "Secret used to check user permissions."
23+
required: false
2024

2125
jobs:
2226
release-lit:
@@ -36,8 +40,9 @@ jobs:
3640
- name: Check Permissions
3741
env:
3842
GITHUB_TOKEN: ${{ github.token }}
43+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
3944
run: |
40-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
45+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
4146
4247
- name: Setup Cpp
4348
uses: aminya/setup-cpp@v1

.github/workflows/release-sources.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
description: Release Version
1717
required: true
1818
type: string
19+
secrets:
20+
RELEASE_TASKS_USER_TOKEN:
21+
description: "Secret used to check user permissions."
22+
required: false
1923
# Run on pull_requests for testing purposes.
2024
pull_request:
2125
paths:

.github/workflows/release-tasks.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,19 @@ jobs:
6666
with:
6767
release-version: ${{ needs.validate-tag.outputs.release-version }}
6868
upload: true
69+
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
70+
secrets:
71+
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
6972

7073
release-lit:
7174
name: Release Lit
7275
needs: validate-tag
7376
uses: ./.github/workflows/release-lit.yml
7477
with:
7578
release-version: ${{ needs.validate-tag.outputs.release-version }}
79+
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
80+
secrets:
81+
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
7682

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

101110
release-sources:
102111
name: Package Release Sources
@@ -109,3 +118,6 @@ jobs:
109118
uses: ./.github/workflows/release-sources.yml
110119
with:
111120
release-version: ${{ needs.validate-tag.outputs.release-version }}
121+
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
122+
secrets:
123+
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
373373
return errorCodeToError(EC);
374374
}
375375
yaml::Input YamlInput(MB.get()->getBuffer());
376+
YamlInput.setAllowUnknownKeys(true);
376377

377378
// Consume YAML file.
378379
YamlInput >> YamlBP;

bolt/test/X86/yaml-unknown-keys.test

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Test that BOLT gracefully handles a YAML profile with unknown keys.
2+
3+
# REQUIRES: system-linux
4+
# RUN: split-file %s %t
5+
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
6+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
7+
# RUN: llvm-bolt %t.exe -o %t.null --data %t/profile.yaml \
8+
# RUN: --profile-ignore-hash -v=1 2>&1 | FileCheck %s
9+
# CHECK: warning: unknown key 'unknown-header-key'
10+
# CHECK: warning: unknown key 'unknown_succ_key'
11+
# CHECK: warning: unknown key 'unknown_block_key'
12+
# CHECK: warning: unknown key 'unknown_function_key'
13+
# CHECK: warning: unknown key 'unknown_toplev_key'
14+
#--- main.s
15+
.globl main
16+
.type main, %function
17+
main:
18+
.cfi_startproc
19+
cmpl $0x0, %eax
20+
jne .LBB0
21+
.LBB0:
22+
retq
23+
.cfi_endproc
24+
.size main, .-main
25+
#--- profile.yaml
26+
---
27+
header:
28+
profile-version: 1
29+
binary-name: 'yaml-multiple-profiles.test.tmp.exe'
30+
binary-build-id: '<unknown>'
31+
profile-flags: [ lbr ]
32+
profile-origin: branch profile reader
33+
profile-events: ''
34+
dfs-order: false
35+
unknown-header-key: true
36+
functions:
37+
- name: 'main'
38+
fid: 1
39+
hash: 0x50BBA3441D436491
40+
exec: 1
41+
nblocks: 1
42+
blocks:
43+
- bid: 0
44+
insns: 2
45+
hash: 0x4D4D8FAF7D4C0000
46+
succ: [ { bid: 1, cnt: 0, unknown_succ_key: 0x10 } ]
47+
unknown_block_key: [ ]
48+
unknown_function_key: 1
49+
unknown_toplev_key: ''
50+
...

bolt/tools/merge-fdata/merge-fdata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ int main(int argc, char **argv) {
392392
if (std::error_code EC = MB.getError())
393393
report_error(InputDataFilename, EC);
394394
yaml::Input YamlInput(MB.get()->getBuffer());
395+
YamlInput.setAllowUnknownKeys(true);
395396

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

clang-tools-extra/clang-tidy/bugprone/CastingThroughVoidCheck.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ void CastingThroughVoidCheck::check(const MatchFinder::MatchResult &Result) {
3838
const auto ST = *Result.Nodes.getNodeAs<QualType>("source_type");
3939
const auto VT = *Result.Nodes.getNodeAs<QualType>("void_type");
4040
const auto *CE = Result.Nodes.getNodeAs<ExplicitCastExpr>("cast");
41-
diag(CE->getExprLoc(), "do not cast %0 to %1 through %2") << ST << TT << VT;
41+
diag(CE->getExprLoc(),
42+
"do not cast %0 to %1 through %2; use reinterpret_cast instead")
43+
<< ST << TT << VT;
4244
}
4345

4446
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,10 @@ async def main() -> None:
511511
)
512512
invocation.append("-list-checks")
513513
invocation.append("-")
514-
if args.quiet:
515-
# Even with -quiet we still want to check if we can call clang-tidy.
516-
with open(os.devnull, "w") as dev_null:
517-
subprocess.check_call(invocation, stdout=dev_null)
518-
else:
519-
subprocess.check_call(invocation)
514+
# Even with -quiet we still want to check if we can call clang-tidy.
515+
subprocess.check_call(
516+
invocation, stdout=subprocess.DEVNULL if args.quiet else None
517+
)
520518
except:
521519
print("Unable to run clang-tidy.", file=sys.stderr)
522520
sys.exit(1)

clang-tools-extra/clangd/CollectMacros.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,
3232
if (Loc.isInvalid() || Loc.isMacroID())
3333
return;
3434

35+
assert(isInsideMainFile(Loc, SM));
3536
auto Name = MacroNameTok.getIdentifierInfo()->getName();
3637
Out.Names.insert(Name);
3738
size_t Start = SM.getFileOffset(Loc);

clang-tools-extra/clangd/CollectMacros.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ class CollectMainFileMacros : public PPCallbacks {
8282

8383
void SourceRangeSkipped(SourceRange R, SourceLocation EndifLoc) override;
8484

85+
// Called when the AST build is done to disable further recording
86+
// of macros by this class. This is needed because some clang-tidy
87+
// checks can trigger PP callbacks by calling directly into the
88+
// preprocessor. Such calls are not interleaved with FileChanged()
89+
// in the expected way, leading this class to erroneously process
90+
// macros that are not in the main file.
91+
void doneParse() { InMainFile = false; }
92+
8593
private:
8694
void add(const Token &MacroNameTok, const MacroInfo *MI,
8795
bool IsDefinition = false, bool InConditionalDirective = false);

0 commit comments

Comments
 (0)