Skip to content

Commit 5ccd554

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into sret_fixes
2 parents 24d8edb + b4263dd commit 5ccd554

File tree

921 files changed

+49621
-16308
lines changed

Some content is hidden

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

921 files changed

+49621
-16308
lines changed

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ env:
4949
jobs:
5050
stage1:
5151
if: github.repository_owner == 'llvm'
52-
runs-on: libcxx-runners-8-set
52+
runs-on: libcxx-runners-set
53+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
5354
continue-on-error: false
5455
strategy:
5556
fail-fast: false
@@ -85,7 +86,8 @@ jobs:
8586
**/crash_diagnostics/*
8687
stage2:
8788
if: github.repository_owner == 'llvm'
88-
runs-on: libcxx-runners-8-set
89+
runs-on: libcxx-runners-set
90+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
8991
needs: [ stage1 ]
9092
continue-on-error: false
9193
strategy:
@@ -162,20 +164,21 @@ jobs:
162164
'benchmarks',
163165
'bootstrapping-build'
164166
]
165-
machine: [ 'libcxx-runners-8-set' ]
167+
machine: [ 'libcxx-runners-set' ]
166168
include:
167169
- config: 'generic-cxx26'
168-
machine: libcxx-runners-8-set
170+
machine: libcxx-runners-set
169171
- config: 'generic-asan'
170-
machine: libcxx-runners-8-set
172+
machine: libcxx-runners-set
171173
- config: 'generic-tsan'
172-
machine: libcxx-runners-8-set
174+
machine: libcxx-runners-set
173175
- config: 'generic-ubsan'
174-
machine: libcxx-runners-8-set
176+
machine: libcxx-runners-set
175177
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
176178
- config: 'generic-msan'
177-
machine: libcxx-runners-8-set
179+
machine: libcxx-runners-set
178180
runs-on: ${{ matrix.machine }}
181+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
179182
steps:
180183
- uses: actions/checkout@v4
181184
- name: ${{ matrix.config }}

clang-tools-extra/clang-query/Query.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
4444
" set bind-root (true|false) "
4545
"Set whether to bind the root matcher to \"root\".\n"
4646
" set print-matcher (true|false) "
47-
"Set whether to print the current matcher,\n"
47+
"Set whether to print the current matcher.\n"
48+
" set enable-profile (true|false) "
49+
"Set whether to enable matcher profiling.\n"
4850
" set traversal <kind> "
4951
"Set traversal kind of clang-query session. Available kinds are:\n"
5052
" AsIs "
@@ -82,27 +84,53 @@ namespace {
8284

8385
struct CollectBoundNodes : MatchFinder::MatchCallback {
8486
std::vector<BoundNodes> &Bindings;
85-
CollectBoundNodes(std::vector<BoundNodes> &Bindings) : Bindings(Bindings) {}
87+
StringRef Unit;
88+
CollectBoundNodes(std::vector<BoundNodes> &Bindings, StringRef Unit)
89+
: Bindings(Bindings), Unit(Unit) {}
8690
void run(const MatchFinder::MatchResult &Result) override {
8791
Bindings.push_back(Result.Nodes);
8892
}
93+
StringRef getID() const override { return Unit; }
94+
};
95+
96+
struct QueryProfiler {
97+
llvm::StringMap<llvm::TimeRecord> Records;
98+
99+
~QueryProfiler() {
100+
llvm::TimerGroup TG("clang-query", "clang-query matcher profiling",
101+
Records);
102+
TG.print(llvm::errs());
103+
llvm::errs().flush();
104+
}
89105
};
90106

91107
} // namespace
92108

93109
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
94110
unsigned MatchCount = 0;
95111

112+
std::optional<QueryProfiler> Profiler;
113+
if (QS.EnableProfile)
114+
Profiler.emplace();
115+
96116
for (auto &AST : QS.ASTs) {
97-
MatchFinder Finder;
117+
ast_matchers::MatchFinder::MatchFinderOptions FinderOptions;
118+
std::optional<llvm::StringMap<llvm::TimeRecord>> Records;
119+
if (QS.EnableProfile) {
120+
Records.emplace();
121+
FinderOptions.CheckProfiling.emplace(*Records);
122+
}
123+
124+
MatchFinder Finder(FinderOptions);
98125
std::vector<BoundNodes> Matches;
99126
DynTypedMatcher MaybeBoundMatcher = Matcher;
100127
if (QS.BindRoot) {
101128
std::optional<DynTypedMatcher> M = Matcher.tryBind("root");
102129
if (M)
103130
MaybeBoundMatcher = *M;
104131
}
105-
CollectBoundNodes Collect(Matches);
132+
StringRef OrigSrcName = AST->getOriginalSourceFileName();
133+
CollectBoundNodes Collect(Matches, OrigSrcName);
106134
if (!Finder.addDynamicMatcher(MaybeBoundMatcher, &Collect)) {
107135
OS << "Not a valid top-level matcher.\n";
108136
return false;
@@ -111,6 +139,8 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
111139
ASTContext &Ctx = AST->getASTContext();
112140
Ctx.getParentMapContext().setTraversalKind(QS.TK);
113141
Finder.matchAST(Ctx);
142+
if (QS.EnableProfile)
143+
Profiler->Records[OrigSrcName] += (*Records)[OrigSrcName];
114144

115145
if (QS.PrintMatcher) {
116146
SmallVector<StringRef, 4> Lines;

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ enum ParsedQueryVariable {
182182
PQV_Output,
183183
PQV_BindRoot,
184184
PQV_PrintMatcher,
185+
PQV_EnableProfile,
185186
PQV_Traversal
186187
};
187188

@@ -285,6 +286,7 @@ QueryRef QueryParser::doParse() {
285286
.Case("output", PQV_Output)
286287
.Case("bind-root", PQV_BindRoot)
287288
.Case("print-matcher", PQV_PrintMatcher)
289+
.Case("enable-profile", PQV_EnableProfile)
288290
.Case("traversal", PQV_Traversal)
289291
.Default(PQV_Invalid);
290292
if (VarStr.empty())
@@ -303,6 +305,9 @@ QueryRef QueryParser::doParse() {
303305
case PQV_PrintMatcher:
304306
Q = parseSetBool(&QuerySession::PrintMatcher);
305307
break;
308+
case PQV_EnableProfile:
309+
Q = parseSetBool(&QuerySession::EnableProfile);
310+
break;
306311
case PQV_Traversal:
307312
Q = parseSetTraversalKind(&QuerySession::TK);
308313
break;

clang-tools-extra/clang-query/QuerySession.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QuerySession {
2626
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2727
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
2828
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
29-
Terminate(false), TK(TK_AsIs) {}
29+
EnableProfile(false), Terminate(false), TK(TK_AsIs) {}
3030

3131
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3232

@@ -36,6 +36,7 @@ class QuerySession {
3636

3737
bool BindRoot;
3838
bool PrintMatcher;
39+
bool EnableProfile;
3940
bool Terminate;
4041

4142
TraversalKind TK;

clang-tools-extra/clangd/TidyProvider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DotClangTidyCache : private FileCache {
4646
[this](std::optional<llvm::StringRef> Data) {
4747
Value.reset();
4848
if (Data && !Data->empty()) {
49-
tidy::DiagCallback Diagnostics = [](const llvm::SMDiagnostic &D) {
49+
auto Diagnostics = [](const llvm::SMDiagnostic &D) {
5050
switch (D.getKind()) {
5151
case llvm::SourceMgr::DK_Error:
5252
elog("tidy-config error at {0}:{1}:{2}: {3}", D.getFilename(),
@@ -149,7 +149,7 @@ static void mergeCheckList(std::optional<std::string> &Checks,
149149
*Checks = llvm::join_items(",", *Checks, List);
150150
}
151151

152-
TidyProviderRef provideEnvironment() {
152+
TidyProvider provideEnvironment() {
153153
static const std::optional<std::string> User = [] {
154154
std::optional<std::string> Ret = llvm::sys::Process::GetEnv("USER");
155155
#ifdef _WIN32
@@ -167,7 +167,7 @@ TidyProviderRef provideEnvironment() {
167167
return [](tidy::ClangTidyOptions &, llvm::StringRef) {};
168168
}
169169

170-
TidyProviderRef provideDefaultChecks() {
170+
TidyProvider provideDefaultChecks() {
171171
// These default checks are chosen for:
172172
// - low false-positive rate
173173
// - providing a lot of value
@@ -251,7 +251,7 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
251251
};
252252
}
253253

254-
TidyProviderRef provideClangdConfig() {
254+
TidyProvider provideClangdConfig() {
255255
return [](tidy::ClangTidyOptions &Opts, llvm::StringRef) {
256256
const auto &CurTidyConfig = Config::current().Diagnostics.ClangTidy;
257257
if (!CurTidyConfig.Checks.empty())

clang-tools-extra/clangd/TidyProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ using TidyProviderRef = llvm::function_ref<void(tidy::ClangTidyOptions &,
3030
TidyProvider combine(std::vector<TidyProvider> Providers);
3131

3232
/// Provider that just sets the defaults.
33-
TidyProviderRef provideEnvironment();
33+
TidyProvider provideEnvironment();
3434

3535
/// Provider that will enable a nice set of default checks if none are
3636
/// specified.
37-
TidyProviderRef provideDefaultChecks();
37+
TidyProvider provideDefaultChecks();
3838

3939
/// Provider the enables a specific set of checks and warnings as errors.
4040
TidyProvider addTidyChecks(llvm::StringRef Checks,
@@ -51,7 +51,7 @@ disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks = {});
5151
TidyProvider provideClangTidyFiles(ThreadsafeFS &);
5252

5353
// Provider that uses clangd configuration files.
54-
TidyProviderRef provideClangdConfig();
54+
TidyProvider provideClangdConfig();
5555

5656
tidy::ClangTidyOptions getTidyOptionsForFile(TidyProviderRef Provider,
5757
llvm::StringRef Filename);

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Improvements to clang-doc
9898
Improvements to clang-query
9999
---------------------------
100100

101-
The improvements are...
101+
- Added `set enable-profile true/false` command for basic matcher profiling.
102102

103103
Improvements to clang-tidy
104104
--------------------------

clang/Maintainers.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Sema
6868
| Sirraide
6969
| aeternalmail\@gmail.com (email), Sirraide (GitHub), Ætérnal (Discord), Sirraide (Discourse)
7070
71+
| Mariya Podchishchaeva
72+
| mariya.podchishchaeva\@intel.com (email), Fznamznon (GitHub), fznamznon (Discord), Fznamznon (Discourse)
73+
7174

7275
Recovery AST
7376
~~~~~~~~~~~~
@@ -138,6 +141,15 @@ Compiler options
138141
| jan_svoboda\@apple.com (email), jansvoboda11 (Phabricator), jansvoboda11 (GitHub)
139142
140143

144+
API Notes
145+
~~~~~~~~~~~~~~~~
146+
| Egor Zhdan
147+
| e_zhdan\@apple.com (email), egorzhdan (GitHub), egor.zhdan (Discourse)
148+
149+
| Saleem Abdulrasool
150+
| compnerd\@compnerd.org (email), compnerd (GitHub), compnerd (Discourse)
151+
152+
141153
OpenBSD driver
142154
~~~~~~~~~~~~~~
143155
| Brad Smith
@@ -150,6 +162,12 @@ Driver parts not covered by someone else
150162
| i\@maskray.me (email), MaskRay (Phabricator), MaskRay (GitHub)
151163
152164

165+
Constant Expressions
166+
~~~~~~~~~~~~~~~~~~~~
167+
| Mariya Podchishchaeva
168+
| mariya.podchishchaeva\@intel.com (email), Fznamznon (GitHub), fznamznon (Discord), Fznamznon (Discourse)
169+
170+
153171
Tools
154172
-----
155173
These maintainers are responsible for user-facing tools under the Clang
@@ -301,6 +319,12 @@ SYCL conformance
301319
| alexey.bader\@intel.com (email), bader (Phabricator), bader (GitHub)
302320
303321

322+
HLSL conformance
323+
~~~~~~~~~~~~~~~~
324+
| Chris Bieneman
325+
| chris.bieneman\@gmail.com (email), llvm-beanz (GitHub), beanz (Discord), beanz (Discourse)
326+
327+
304328
Issue Triage
305329
~~~~~~~~~~~~
306330
| Shafik Yaghmour

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ Bug Fixes to C++ Support
591591
- Clang now correctly ignores previous partial specializations of member templates explicitly specialized for
592592
an implicitly instantiated class template specialization. (#GH51051)
593593
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
594+
- Name independent data members were not correctly initialized from default member initializers. (#GH114069)
594595

595596
Bug Fixes to AST Handling
596597
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -716,6 +717,7 @@ CUDA Support
716717
^^^^^^^^^^^^
717718
- Clang now supports CUDA SDK up to 12.6
718719
- Added support for sm_100
720+
- Added support for `__grid_constant__` attribute.
719721

720722
AIX Support
721723
^^^^^^^^^^^
@@ -887,6 +889,7 @@ OpenMP Support
887889
--------------
888890
- Added support for 'omp assume' directive.
889891
- Added support for 'omp scope' directive.
892+
- Added support for allocator-modifier in 'allocate' clause.
890893

891894
Improvements
892895
^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "clang/AST/ExternalASTSource.h"
2424
#include "clang/AST/PrettyPrinter.h"
2525
#include "clang/AST/RawCommentList.h"
26+
#include "clang/AST/SYCLKernelInfo.h"
2627
#include "clang/AST/TemplateName.h"
2728
#include "clang/Basic/LLVM.h"
2829
#include "clang/Basic/PartialDiagnostic.h"
@@ -1040,7 +1041,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
10401041
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst,
10411042
UsingShadowDecl *Pattern);
10421043

1043-
FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field);
1044+
FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) const;
10441045

10451046
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl);
10461047

@@ -1239,6 +1240,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
12391240
/// in device compilation.
12401241
llvm::DenseSet<const FunctionDecl *> CUDAImplicitHostDeviceFunUsedByDevice;
12411242

1243+
/// Map of SYCL kernels indexed by the unique type used to name the kernel.
1244+
/// Entries are not serialized but are recreated on deserialization of a
1245+
/// sycl_kernel_entry_point attributed function declaration.
1246+
llvm::DenseMap<CanQualType, SYCLKernelInfo> SYCLKernels;
1247+
12421248
/// For capturing lambdas with an explicit object parameter whose type is
12431249
/// derived from the lambda type, we need to perform derived-to-base
12441250
/// conversion so we can access the captures; the cast paths for that
@@ -3340,6 +3346,14 @@ class ASTContext : public RefCountedBase<ASTContext> {
33403346
void getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
33413347
GlobalDecl GD) const;
33423348

3349+
/// Generates and stores SYCL kernel metadata for the provided
3350+
/// SYCL kernel entry point function. The provided function must have
3351+
/// an attached sycl_kernel_entry_point attribute that specifies a unique
3352+
/// type for the name of a SYCL kernel. Callers are required to detect
3353+
/// conflicting SYCL kernel names and issue a diagnostic prior to calling
3354+
/// this function.
3355+
void registerSYCLEntryPointFunction(FunctionDecl *FD);
3356+
33433357
//===--------------------------------------------------------------------===//
33443358
// Statistics
33453359
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)