Skip to content

Commit 9323ab5

Browse files
authored
Merge branch 'main' into 108760-misc-use-internal-linkage-fixhint-incorrect
2 parents e87523e + 313ad85 commit 9323ab5

File tree

3,193 files changed

+145221
-70925
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,193 files changed

+145221
-70925
lines changed

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,24 @@ jobs:
193193
**/crash_diagnostics/*
194194
195195
macos:
196-
runs-on: macos-14
197196
needs: [ stage1 ]
198197
strategy:
199-
fail-fast: true
198+
fail-fast: false
200199
matrix:
201-
config: [
202-
generic-cxx03,
203-
generic-cxx23,
204-
generic-modules,
205-
apple-configuration
206-
]
200+
include:
201+
- config: generic-cxx03
202+
os: macos-latest
203+
- config: generic-cxx23
204+
os: macos-latest
205+
- config: generic-modules
206+
os: macos-latest
207+
- config: apple-configuration
208+
os: macos-latest
209+
- config: apple-system
210+
os: macos-13
211+
- config: apple-system-hardened
212+
os: macos-13
213+
runs-on: ${{ matrix.os }}
207214
steps:
208215
- uses: actions/checkout@v4
209216
- uses: maxim-lobanov/setup-xcode@v1

.github/workflows/release-binaries-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ on:
4343
- '.github/workflows/release-binaries.yml'
4444
- '.github/workflows/release-binaries-setup-stage/*'
4545
- '.github/workflows/release-binaries-save-stage/*'
46+
- 'clang/cmake/caches/Release.cmake'
4647

4748
concurrency:
4849
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }}

.github/workflows/release-binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ jobs:
420420
attestations: write # For artifact attestations
421421

422422
steps:
423+
- name: Checkout Release Scripts
424+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
425+
with:
426+
sparse-checkout: |
427+
llvm/utils/release/github-upload-release.py
428+
llvm/utils/git/requirements.txt
429+
sparse-checkout-cone-mode: false
430+
423431
- name: 'Download artifact'
424432
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
425433
with:
@@ -442,14 +450,6 @@ jobs:
442450
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
443451
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
444452

445-
- name: Checkout Release Scripts
446-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
447-
with:
448-
sparse-checkout: |
449-
llvm/utils/release/github-upload-release.py
450-
llvm/utils/git/requirements.txt
451-
sparse-checkout-cone-mode: false
452-
453453
- name: Install Python Requirements
454454
run: |
455455
pip install --require-hashes -r ./llvm/utils/git/requirements.txt

.github/workflows/release-documentation.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,20 @@ jobs:
7272
ref: main
7373
fetch-depth: 0
7474
path: www-releases
75+
persist-credentials: false
7576

7677
- name: Upload Release Notes
7778
if: env.upload
7879
env:
79-
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
80+
GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
8081
run: |
81-
mkdir -p ../www-releases/${{ inputs.release-version }}
82-
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
83-
cd ../www-releases
82+
mkdir -p www-releases/${{ inputs.release-version }}
83+
mv ./docs-build/html-export/* www-releases/${{ inputs.release-version }}
84+
cd www-releases
85+
git checkout -b ${{ inputs.release-version }}
8486
git add ${{ inputs.release-version }}
8587
git config user.email "[email protected]"
8688
git config user.name "llvmbot"
8789
git commit -a -m "Add ${{ inputs.release-version }} documentation"
88-
git push "https://[email protected]/${{ github.repository_owner }}/www-releases" main:main
90+
git push --force "https://[email protected]/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
91+
gh pr create -f -B main -H ${{ inputs.release-version }} -R llvmbot/www-releases

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ autoconf/autom4te.cache
5151
/CMakeSettings.json
5252
# CLion project configuration
5353
/.idea
54+
/cmake-build*
5455

5556
#==============================================================================#
5657
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

bolt/test/AArch64/constant_island_pie_update.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
# RUN: %clang %cflags -fPIC -pie %t.o -o %t.rela.exe -nostdlib \
99
# RUN: -Wl,-q -Wl,-z,notext
1010
# RUN: llvm-bolt %t.rela.exe -o %t.rela.bolt --use-old-text=0 --lite=0
11-
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.rela.bolt | FileCheck %s
11+
# RUN: llvm-objdump -j .text -d -z --show-all-symbols %t.rela.bolt | FileCheck %s
1212
# RUN: llvm-readelf -rsW %t.rela.bolt | FileCheck --check-prefix=ELFCHECK %s
1313
// .relr.dyn
1414
# RUN: %clang %cflags -fPIC -pie %t.o -o %t.relr.exe -nostdlib \
1515
# RUN: -Wl,-q -Wl,-z,notext -Wl,--pack-dyn-relocs=relr
1616
# RUN: llvm-objcopy --remove-section .rela.mytext %t.relr.exe
1717
# RUN: llvm-bolt %t.relr.exe -o %t.relr.bolt --use-old-text=0 --lite=0
18-
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.relr.bolt | FileCheck %s
19-
# RUN: llvm-objdump -j .text -d %t.relr.bolt | \
18+
# RUN: llvm-objdump -j .text -d -z --show-all-symbols %t.relr.bolt | FileCheck %s
19+
# RUN: llvm-objdump -j .text -d -z %t.relr.bolt | \
2020
# RUN: FileCheck %s --check-prefix=ADDENDCHECK
2121
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=RELRELFCHECK %s
2222
# RUN: llvm-readelf -SW %t.relr.bolt | FileCheck --check-prefix=RELRSZCHECK %s

bolt/test/AArch64/update-weak-reference-symbol.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %clang %cflags -Wl,-z,notext -shared -Wl,-q %s -o %t.so
44
// RUN: llvm-bolt %t.so -o %t.so.bolt
55
// RUN: llvm-nm -n %t.so.bolt > %t.out.txt
6-
// RUN: llvm-objdump -dj .rodata %t.so.bolt >> %t.out.txt
6+
// RUN: llvm-objdump -z -dj .rodata %t.so.bolt >> %t.out.txt
77
// RUN: FileCheck %s --input-file=%t.out.txt
88

99
# CHECK: w func_1

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "SuspiciousStringviewDataUsageCheck.h"
7979
#include "SwappedArgumentsCheck.h"
8080
#include "SwitchMissingDefaultCaseCheck.h"
81+
#include "TaggedUnionMemberCountCheck.h"
8182
#include "TerminatingContinueCheck.h"
8283
#include "ThrowKeywordMissingCheck.h"
8384
#include "TooSmallLoopVariableCheck.h"
@@ -229,6 +230,8 @@ class BugproneModule : public ClangTidyModule {
229230
"bugprone-suspicious-stringview-data-usage");
230231
CheckFactories.registerCheck<SwappedArgumentsCheck>(
231232
"bugprone-swapped-arguments");
233+
CheckFactories.registerCheck<TaggedUnionMemberCountCheck>(
234+
"bugprone-tagged-union-member-count");
232235
CheckFactories.registerCheck<TerminatingContinueCheck>(
233236
"bugprone-terminating-continue");
234237
CheckFactories.registerCheck<ThrowKeywordMissingCheck>(

clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ add_clang_library(clangTidyBugproneModule
7373
SuspiciousSemicolonCheck.cpp
7474
SuspiciousStringCompareCheck.cpp
7575
SwappedArgumentsCheck.cpp
76+
TaggedUnionMemberCountCheck.cpp
7677
TerminatingContinueCheck.cpp
7778
ThrowKeywordMissingCheck.cpp
7879
TooSmallLoopVariableCheck.cpp

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

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,58 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "PosixReturnCheck.h"
10-
#include "../utils/Matchers.h"
1110
#include "clang/AST/ASTContext.h"
1211
#include "clang/ASTMatchers/ASTMatchFinder.h"
12+
#include "clang/ASTMatchers/ASTMatchers.h"
1313
#include "clang/Lex/Lexer.h"
1414

1515
using namespace clang::ast_matchers;
1616

1717
namespace clang::tidy::bugprone {
1818

19-
static StringRef getFunctionSpelling(const MatchFinder::MatchResult &Result,
20-
const char *BindingStr) {
21-
const CallExpr *MatchedCall = cast<CallExpr>(
22-
(Result.Nodes.getNodeAs<BinaryOperator>(BindingStr))->getLHS());
19+
static StringRef getFunctionSpelling(const MatchFinder::MatchResult &Result) {
20+
const auto *MatchedCall = Result.Nodes.getNodeAs<CallExpr>("call");
2321
const SourceManager &SM = *Result.SourceManager;
2422
return Lexer::getSourceText(CharSourceRange::getTokenRange(
2523
MatchedCall->getCallee()->getSourceRange()),
2624
SM, Result.Context->getLangOpts());
2725
}
2826

2927
void PosixReturnCheck::registerMatchers(MatchFinder *Finder) {
28+
const auto PosixCall =
29+
callExpr(callee(functionDecl(
30+
anyOf(matchesName("^::posix_"), matchesName("^::pthread_")),
31+
unless(hasName("::posix_openpt")))))
32+
.bind("call");
33+
const auto ZeroIntegerLiteral = integerLiteral(equals(0));
34+
const auto NegIntegerLiteral =
35+
unaryOperator(hasOperatorName("-"), hasUnaryOperand(integerLiteral()));
36+
3037
Finder->addMatcher(
3138
binaryOperator(
32-
hasOperatorName("<"),
33-
hasLHS(callExpr(callee(functionDecl(
34-
anyOf(matchesName("^::posix_"), matchesName("^::pthread_")),
35-
unless(hasName("::posix_openpt")))))),
36-
hasRHS(integerLiteral(equals(0))))
39+
anyOf(allOf(hasOperatorName("<"), hasLHS(PosixCall),
40+
hasRHS(ZeroIntegerLiteral)),
41+
allOf(hasOperatorName(">"), hasLHS(ZeroIntegerLiteral),
42+
hasRHS(PosixCall))))
3743
.bind("ltzop"),
3844
this);
3945
Finder->addMatcher(
4046
binaryOperator(
41-
hasOperatorName(">="),
42-
hasLHS(callExpr(callee(functionDecl(
43-
anyOf(matchesName("^::posix_"), matchesName("^::pthread_")),
44-
unless(hasName("::posix_openpt")))))),
45-
hasRHS(integerLiteral(equals(0))))
47+
anyOf(allOf(hasOperatorName(">="), hasLHS(PosixCall),
48+
hasRHS(ZeroIntegerLiteral)),
49+
allOf(hasOperatorName("<="), hasLHS(ZeroIntegerLiteral),
50+
hasRHS(PosixCall))))
4651
.bind("atop"),
4752
this);
53+
Finder->addMatcher(binaryOperator(hasAnyOperatorName("==", "!="),
54+
hasOperands(PosixCall, NegIntegerLiteral))
55+
.bind("binop"),
56+
this);
4857
Finder->addMatcher(
49-
binaryOperator(
50-
hasAnyOperatorName("==", "!=", "<=", "<"),
51-
hasLHS(callExpr(callee(functionDecl(
52-
anyOf(matchesName("^::posix_"), matchesName("^::pthread_")),
53-
unless(hasName("::posix_openpt")))))),
54-
hasRHS(unaryOperator(hasOperatorName("-"),
55-
hasUnaryOperand(integerLiteral()))))
58+
binaryOperator(anyOf(allOf(hasAnyOperatorName("<=", "<"),
59+
hasLHS(PosixCall), hasRHS(NegIntegerLiteral)),
60+
allOf(hasAnyOperatorName(">", ">="),
61+
hasLHS(NegIntegerLiteral), hasRHS(PosixCall))))
5662
.bind("binop"),
5763
this);
5864
}
@@ -61,23 +67,26 @@ void PosixReturnCheck::check(const MatchFinder::MatchResult &Result) {
6167
if (const auto *LessThanZeroOp =
6268
Result.Nodes.getNodeAs<BinaryOperator>("ltzop")) {
6369
SourceLocation OperatorLoc = LessThanZeroOp->getOperatorLoc();
70+
StringRef NewBinOp =
71+
LessThanZeroOp->getOpcode() == BinaryOperator::Opcode::BO_LT ? ">"
72+
: "<";
6473
diag(OperatorLoc, "the comparison always evaluates to false because %0 "
6574
"always returns non-negative values")
66-
<< getFunctionSpelling(Result, "ltzop")
67-
<< FixItHint::CreateReplacement(OperatorLoc, Twine(">").str());
75+
<< getFunctionSpelling(Result)
76+
<< FixItHint::CreateReplacement(OperatorLoc, NewBinOp);
6877
return;
6978
}
7079
if (const auto *AlwaysTrueOp =
7180
Result.Nodes.getNodeAs<BinaryOperator>("atop")) {
7281
diag(AlwaysTrueOp->getOperatorLoc(),
7382
"the comparison always evaluates to true because %0 always returns "
7483
"non-negative values")
75-
<< getFunctionSpelling(Result, "atop");
84+
<< getFunctionSpelling(Result);
7685
return;
7786
}
7887
const auto *BinOp = Result.Nodes.getNodeAs<BinaryOperator>("binop");
7988
diag(BinOp->getOperatorLoc(), "%0 only returns non-negative values")
80-
<< getFunctionSpelling(Result, "binop");
89+
<< getFunctionSpelling(Result);
8190
}
8291

8392
} // namespace clang::tidy::bugprone

0 commit comments

Comments
 (0)