Skip to content

Commit 2c57c89

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into remove-old-res-middle
2 parents c574bed + f4d599c commit 2c57c89

File tree

2,270 files changed

+94913
-59972
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,270 files changed

+94913
-59972
lines changed

.ci/metrics/metrics.py

Lines changed: 164 additions & 154 deletions
Large diffs are not rendered by default.

.github/workflows/issue-write.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: 'Comment on PR'
4141
if: steps.download-artifact.outputs.artifact-id != ''
42-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
42+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
4343
with:
4444
github-token: ${{ secrets.GITHUB_TOKEN }}
4545
script: |

.github/workflows/libclang-python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
python-version: ["3.8", "3.11"]
33+
python-version: ["3.8", "3.13"]
3434
uses: ./.github/workflows/llvm-project-tests.yml
3535
with:
3636
build_target: check-clang-python

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
cc: 'gcc-14'
5656
cxx: 'g++-14'
5757
steps:
58-
- uses: actions/checkout@v4
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5959
- name: ${{ matrix.config }}.${{ matrix.cxx }}
6060
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
6161
env:
@@ -105,7 +105,7 @@ jobs:
105105
cc: 'clang-18'
106106
cxx: 'clang++-18'
107107
steps:
108-
- uses: actions/checkout@v4
108+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
109109
- name: ${{ matrix.config }}
110110
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
111111
env:
@@ -169,7 +169,7 @@ jobs:
169169
runs-on: ${{ matrix.machine }}
170170
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
171171
steps:
172-
- uses: actions/checkout@v4
172+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
173173
- name: ${{ matrix.config }}
174174
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
175175
env:
@@ -207,11 +207,11 @@ jobs:
207207
os: macos-13
208208
runs-on: ${{ matrix.os }}
209209
steps:
210-
- uses: actions/checkout@v4
211-
- uses: maxim-lobanov/setup-xcode@v1
210+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
211+
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
212212
with:
213213
xcode-version: 'latest'
214-
- uses: seanmiddleditch/gha-setup-ninja@master
214+
- uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6
215215
- name: Build and test
216216
run: |
217217
python3 -m venv .venv
@@ -247,7 +247,7 @@ jobs:
247247
- { config: mingw-dll-i686, mingw: true }
248248
- { config: mingw-incomplete-sysroot, mingw: true }
249249
steps:
250-
- uses: actions/checkout@v4
250+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
251251
- name: Install dependencies
252252
run: |
253253
choco install -y ninja
@@ -275,7 +275,7 @@ jobs:
275275
echo "c:\Program Files\Git\usr\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
276276
- name: Set up the MSVC dev environment
277277
if: ${{ matrix.mingw != true }}
278-
uses: ilammy/msvc-dev-cmd@v1
278+
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
279279
- name: Build and test
280280
run: |
281281
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}

.github/workflows/libcxx-build-containers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
packages: write
3333

3434
steps:
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636

3737
- name: Build the Linux builder image
3838
working-directory: libcxx/utils/ci
@@ -47,7 +47,7 @@ jobs:
4747
# TAG: ${{ github.sha }}
4848

4949
- name: Log in to GitHub Container Registry
50-
uses: docker/login-action@v3
50+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
5151
with:
5252
registry: ghcr.io
5353
username: ${{ github.actor }}

.github/workflows/libcxx-check-generated-files.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-24.04
1313
steps:
1414
- name: Fetch LLVM sources
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616

1717
- name: Install dependencies
18-
uses: aminya/setup-cpp@v1
18+
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
1919
with:
2020
clangformat: 17.0.1
2121
ninja: true

.github/workflows/release-asset-audit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def _get_uploaders(release_version):
2424
return set(
2525
[
2626
"DimitryAndric",
27-
"stefanp-ibm",
27+
"stefanp-synopsys",
2828
"lei137",
2929
"omjavaid",
3030
"nicolerabjohn",

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

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../utils/OptionsUtils.h"
1313
#include "clang/AST/ASTContext.h"
1414
#include "clang/ASTMatchers/ASTMatchFinder.h"
15+
#include "clang/ASTMatchers/ASTMatchers.h"
1516
#include <array>
1617

1718
using namespace clang::ast_matchers;
@@ -27,27 +28,11 @@ AST_MATCHER_P(QualType, hasCleanType, Matcher<QualType>, InnerMatcher) {
2728
Finder, Builder);
2829
}
2930

30-
constexpr std::array<StringRef, 2> NameList{
31+
constexpr std::array<StringRef, 2> MakeSmartPtrList{
3132
"::std::make_unique",
3233
"::std::make_shared",
3334
};
34-
35-
Matcher<Expr> constructFrom(Matcher<QualType> TypeMatcher,
36-
Matcher<Expr> ArgumentMatcher) {
37-
return expr(
38-
anyOf(
39-
// construct optional
40-
cxxConstructExpr(argumentCountIs(1U), hasType(TypeMatcher),
41-
hasArgument(0U, ArgumentMatcher)),
42-
// known template methods in std
43-
callExpr(argumentCountIs(1),
44-
callee(functionDecl(
45-
matchers::matchesAnyListedName(NameList),
46-
hasTemplateArgument(0, refersToType(TypeMatcher)))),
47-
hasArgument(0, ArgumentMatcher))),
48-
unless(anyOf(hasAncestor(typeLoc()),
49-
hasAncestor(expr(matchers::hasUnevaluatedContext())))));
50-
}
35+
constexpr StringRef MakeOptional = "::std::make_optional";
5136

5237
} // namespace
5338

@@ -74,7 +59,7 @@ void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
7459
auto EqualsBoundOptionalType =
7560
qualType(hasCleanType(equalsBoundNode("optional-type")));
7661

77-
auto OptionalDereferenceMatcher = callExpr(
62+
auto OptionalDerefMatcherImpl = callExpr(
7863
anyOf(
7964
cxxOperatorCallExpr(hasOverloadedOperatorName("*"),
8065
hasUnaryOperand(hasType(EqualsBoundOptionalType)))
@@ -88,11 +73,41 @@ void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
8873

8974
auto StdMoveCallMatcher =
9075
callExpr(argumentCountIs(1), callee(functionDecl(hasName("::std::move"))),
91-
hasArgument(0, ignoringImpCasts(OptionalDereferenceMatcher)));
76+
hasArgument(0, ignoringImpCasts(OptionalDerefMatcherImpl)));
77+
auto OptionalDerefMatcher =
78+
ignoringImpCasts(anyOf(OptionalDerefMatcherImpl, StdMoveCallMatcher));
79+
9280
Finder->addMatcher(
93-
expr(constructFrom(BindOptionalType,
94-
ignoringImpCasts(anyOf(OptionalDereferenceMatcher,
95-
StdMoveCallMatcher))))
81+
expr(anyOf(
82+
// construct optional
83+
cxxConstructExpr(argumentCountIs(1), hasType(BindOptionalType),
84+
hasArgument(0, OptionalDerefMatcher)),
85+
// known template methods in std
86+
callExpr(
87+
argumentCountIs(1),
88+
anyOf(
89+
// match std::make_unique std::make_shared
90+
callee(functionDecl(
91+
matchers::matchesAnyListedName(MakeSmartPtrList),
92+
hasTemplateArgument(
93+
0, refersToType(BindOptionalType)))),
94+
// match first std::make_optional by limit argument count
95+
// (1) and template count (1).
96+
// 1. template< class T > constexpr
97+
// std::optional<decay_t<T>> make_optional(T&& value);
98+
// 2. template< class T, class... Args > constexpr
99+
// std::optional<T> make_optional(Args&&... args);
100+
callee(functionDecl(templateArgumentCountIs(1),
101+
hasName(MakeOptional),
102+
returns(BindOptionalType)))),
103+
hasArgument(0, OptionalDerefMatcher)),
104+
callExpr(
105+
106+
argumentCountIs(1),
107+
108+
hasArgument(0, OptionalDerefMatcher))),
109+
unless(anyOf(hasAncestor(typeLoc()),
110+
hasAncestor(expr(matchers::hasUnevaluatedContext())))))
96111
.bind("expr"),
97112
this);
98113
}

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,14 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
136136
return;
137137

138138
VariableCategory VC = VariableCategory::Value;
139-
if (Variable->getType()->isReferenceType())
139+
const QualType VT = Variable->getType();
140+
if (VT->isReferenceType())
140141
VC = VariableCategory::Reference;
141-
if (Variable->getType()->isPointerType())
142+
else if (VT->isPointerType())
142143
VC = VariableCategory::Pointer;
143-
if (Variable->getType()->isArrayType()) {
144-
if (const auto *ArrayT = dyn_cast<ArrayType>(Variable->getType())) {
145-
if (ArrayT->getElementType()->isPointerType())
146-
VC = VariableCategory::Pointer;
147-
}
148-
}
144+
else if (const auto *ArrayT = dyn_cast<ArrayType>(VT))
145+
if (ArrayT->getElementType()->isPointerType())
146+
VC = VariableCategory::Pointer;
149147

150148
// Each variable can only be in one category: Value, Pointer, Reference.
151149
// Analysis can be controlled for every category.

clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ AST_MATCHER(FunctionDecl, hasBody) { return Node.hasBody(); }
5252
static bool isInMainFile(SourceLocation L, SourceManager &SM,
5353
const FileExtensionsSet &HeaderFileExtensions) {
5454
for (;;) {
55-
if (utils::isSpellingLocInHeaderFile(L, SM, HeaderFileExtensions))
55+
if (utils::isExpansionLocInHeaderFile(L, SM, HeaderFileExtensions))
5656
return false;
5757
if (SM.isInMainFile(L))
5858
return true;

0 commit comments

Comments
 (0)