Skip to content

Commit 3cb2d8d

Browse files
authored
Merge branch 'main' into dag-unused-patternmatch
2 parents 461ab51 + 0e5f9f6 commit 3cb2d8d

File tree

658 files changed

+115007
-7910
lines changed

Some content is hidden

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

658 files changed

+115007
-7910
lines changed

.clang-tidy

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner'
1+
Checks: >
2+
-*,
3+
clang-diagnostic-*,
4+
llvm-*,
5+
misc-*,
6+
-misc-const-correctness,
7+
-misc-include-cleaner,
8+
-misc-no-recursion,
9+
-misc-non-private-member-variables-in-classes,
10+
-misc-unused-parameters,
11+
-misc-use-anonymous-namespace,
12+
readability-identifier-naming
13+
214
CheckOptions:
315
- key: readability-identifier-naming.ClassCase
416
value: CamelCase

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ concurrency:
3636
jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
39-
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:b060022103f551d8ca1dad84122ef73927c86512
39+
runs-on: llvm-premerge-libcxx-runners
4140
continue-on-error: false
4241
strategy:
4342
fail-fast: false
@@ -74,8 +73,7 @@ jobs:
7473
**/crash_diagnostics/*
7574
stage2:
7675
if: github.repository_owner == 'llvm'
77-
runs-on: libcxx-self-hosted-linux
78-
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
76+
runs-on: llvm-premerge-libcxx-runners
7977
needs: [ stage1 ]
8078
continue-on-error: false
8179
strategy:
@@ -149,21 +147,20 @@ jobs:
149147
'generic-static',
150148
'bootstrapping-build'
151149
]
152-
machine: [ 'libcxx-self-hosted-linux' ]
150+
machine: [ 'llvm-premerge-libcxx-runners' ]
153151
include:
154152
- config: 'generic-cxx26'
155-
machine: libcxx-self-hosted-linux
153+
machine: llvm-premerge-libcxx-runners
156154
- config: 'generic-asan'
157-
machine: libcxx-self-hosted-linux
155+
machine: llvm-premerge-libcxx-runners
158156
- config: 'generic-tsan'
159-
machine: libcxx-self-hosted-linux
157+
machine: llvm-premerge-libcxx-runners
160158
- config: 'generic-ubsan'
161-
machine: libcxx-self-hosted-linux
159+
machine: llvm-premerge-libcxx-runners
162160
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
163161
- config: 'generic-msan'
164-
machine: libcxx-self-hosted-linux
162+
machine: llvm-premerge-libcxx-runners
165163
runs-on: ${{ matrix.machine }}
166-
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
167164
steps:
168165
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
169166
- name: ${{ matrix.config }}

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 0 additions & 158 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install clang-format
5656
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
5757
with:
58-
clangformat: 20.1.5
58+
clangformat: 20.1.8
5959

6060
- name: Setup Python env
6161
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0

.github/workflows/premerge.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
6464
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
6565
- name: Upload Artifacts
66+
if: '!cancelled()'
6667
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
6768
with:
6869
name: Premerge Artifacts (Linux)
@@ -113,6 +114,7 @@ jobs:
113114
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
114115
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
115116
- name: Upload Artifacts
117+
if: '!cancelled()'
116118
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
117119
with:
118120
name: Premerge Artifacts (Windows)

clang-tools-extra/clangd/ModulesBuilder.cpp

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ class ReusablePrerequisiteModules : public PrerequisiteModules {
160160
RequiredModule->getModuleFilePath().str());
161161
}
162162

163+
std::string getAsString() const {
164+
std::string Result;
165+
llvm::raw_string_ostream OS(Result);
166+
for (const auto &ModuleFile : RequiredModules) {
167+
OS << "-fmodule-file=" << ModuleFile->getModuleName() << "="
168+
<< ModuleFile->getModuleFilePath() << " ";
169+
}
170+
return Result;
171+
}
172+
163173
bool canReuse(const CompilerInvocation &CI,
164174
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) const override;
165175

@@ -296,8 +306,27 @@ buildModuleFile(llvm::StringRef ModuleName, PathRef ModuleUnitFileName,
296306
GenerateReducedModuleInterfaceAction Action;
297307
Clang->ExecuteAction(Action);
298308

299-
if (Clang->getDiagnostics().hasErrorOccurred())
300-
return llvm::createStringError("Compilation failed");
309+
if (Clang->getDiagnostics().hasErrorOccurred()) {
310+
std::string Cmds;
311+
for (const auto &Arg : Inputs.CompileCommand.CommandLine) {
312+
if (!Cmds.empty())
313+
Cmds += " ";
314+
Cmds += Arg;
315+
}
316+
317+
clangd::vlog("Failed to compile {0} with command: {1}.", ModuleUnitFileName,
318+
Cmds);
319+
320+
std::string BuiltModuleFilesStr = BuiltModuleFiles.getAsString();
321+
if (!BuiltModuleFilesStr.empty())
322+
clangd::vlog("The actual used module files built by clangd is {0}",
323+
BuiltModuleFilesStr);
324+
325+
return llvm::createStringError(
326+
llvm::formatv("Failed to compile {0}. Use '--log=verbose' to view "
327+
"detailed failure reasons.",
328+
ModuleUnitFileName));
329+
}
301330

302331
return ModuleFile{ModuleName, Inputs.CompileCommand.Output};
303332
}

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,9 +1554,9 @@ the configuration (without a prefix: ``Auto``).
15541554

15551555
.. code-block:: c++
15561556

1557-
#define A \
1558-
int aaaa; \
1559-
int b; \
1557+
#define A \
1558+
int aaaa; \
1559+
int b; \
15601560
int dddddddddd;
15611561

15621562

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,10 @@ Bug Fixes in This Version
776776
- In C23, something like ``[[/*possible attributes*/]];`` is an attribute
777777
declaration, not a statement. So it is not allowed by the syntax in places
778778
where a statement is required, specifically as the secondary block of a
779-
selection or iteration statement. This differs from C++, since C++ allows
779+
selection or iteration statement. This differs from C++, since C++ allows
780780
declaration statements. Clang now emits a warning for these patterns. (#GH141659)
781+
- Fixed false positives for redeclaration errors of using enum in
782+
nested scopes. (#GH147495)
781783

782784
Bug Fixes to Compiler Builtins
783785
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -893,6 +895,7 @@ Bug Fixes to C++ Support
893895
- Fixed a Clang regression in C++20 mode where unresolved dependent call expressions were created inside non-dependent contexts (#GH122892)
894896
- Clang now emits the ``-Wunused-variable`` warning when some structured bindings are unused
895897
and the ``[[maybe_unused]]`` attribute is not applied. (#GH125810)
898+
- Fixed ``static_cast`` not performing access or ambiguity checks when converting to an rvalue reference to a base class. (#GH121429)
896899
- Declarations using class template argument deduction with redundant
897900
parentheses around the declarator are no longer rejected. (#GH39811)
898901
- Fixed a crash caused by invalid declarations of ``std::initializer_list``. (#GH132256)
@@ -930,6 +933,7 @@ Bug Fixes to C++ Support
930933
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
931934
- Correctly handles calling an explicit object member function template overload set
932935
through its address (``(&Foo::bar<baz>)()``).
936+
- Fix a crash when forming an invalid call to an operator with an explicit object member. (#GH147121)
933937
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
934938
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
935939
- Fixed parsing of lambda expressions that appear after ``*`` or ``&`` in contexts where a declaration can appear. (#GH63880)

clang/include/clang/APINotes/APINotesManager.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ class APINotesManager {
5050
/// source file from which an entity was declared.
5151
bool ImplicitAPINotes;
5252

53+
/// Whether to apply all APINotes as optionally-applied versioned
54+
/// entities. This means that when building a Clang module,
55+
/// we capture every note on a given decl wrapped in a SwiftVersionedAttr
56+
/// (with an empty version field for unversioned notes), and have the
57+
/// client apply the relevant version's notes.
58+
bool VersionIndependentSwift;
59+
5360
/// The Swift version to use when interpreting versioned API notes.
5461
llvm::VersionTuple SwiftVersion;
5562

@@ -167,6 +174,8 @@ class APINotesManager {
167174

168175
/// Find the API notes readers that correspond to the given source location.
169176
llvm::SmallVector<APINotesReader *, 2> findAPINotes(SourceLocation Loc);
177+
178+
bool captureVersionIndependentSwift() { return VersionIndependentSwift; }
170179
};
171180

172181
} // end namespace api_notes
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===- LifetimeSafety.h - C++ Lifetime Safety Analysis -*----------- C++-*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines the entry point for a dataflow-based static analysis
10+
// that checks for C++ lifetime violations.
11+
//
12+
// The analysis is based on the concepts of "origins" and "loans" to track
13+
// pointer lifetimes and detect issues like use-after-free and dangling
14+
// pointers. See the RFC for more details:
15+
// https://discourse.llvm.org/t/rfc-intra-procedural-lifetime-analysis-in-clang/86291
16+
//
17+
//===----------------------------------------------------------------------===//
18+
#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_H
19+
#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_H
20+
#include "clang/AST/DeclBase.h"
21+
#include "clang/Analysis/AnalysisDeclContext.h"
22+
#include "clang/Analysis/CFG.h"
23+
namespace clang {
24+
25+
void runLifetimeSafetyAnalysis(const DeclContext &DC, const CFG &Cfg,
26+
AnalysisDeclContext &AC);
27+
28+
} // namespace clang
29+
30+
#endif // LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_H

0 commit comments

Comments
 (0)