Skip to content

Commit 2857d49

Browse files
committed
Merge branch 'main' of https://github.com/AmrDeveloper/llvm-project into cir_upstream_sizeof_alignof
2 parents ec780a7 + bd0d28a commit 2857d49

File tree

1,739 files changed

+50178
-35451
lines changed

Some content is hidden

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

1,739 files changed

+50178
-35451
lines changed

.ci/compute-projects.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ function compute-projects-to-test() {
1818
shift
1919
projects=${@}
2020
for project in ${projects}; do
21-
echo "${project}"
2221
case ${project} in
2322
lld)
24-
for p in bolt cross-project-tests; do
23+
for p in lld bolt cross-project-tests; do
2524
echo $p
2625
done
2726
;;
2827
llvm)
29-
for p in bolt clang clang-tools-extra lld lldb mlir polly; do
28+
for p in llvm bolt clang clang-tools-extra lld lldb mlir polly; do
3029
echo $p
3130
done
3231
# Flang is not stable in Windows CI at the moment
@@ -36,21 +35,30 @@ function compute-projects-to-test() {
3635
;;
3736
clang)
3837
# lldb is temporarily removed to alleviate Linux pre-commit CI waiting times
39-
for p in clang-tools-extra compiler-rt cross-project-tests; do
38+
for p in clang clang-tools-extra compiler-rt cross-project-tests; do
4039
echo $p
4140
done
4241
;;
4342
clang-tools-extra)
44-
echo libc
43+
for p in clang-tools-extra libc; do
44+
echo $p
45+
done
4546
;;
4647
mlir)
48+
echo mlir
49+
# Flang is not stable in Windows CI at the moment
50+
if [[ $isForWindows == 0 ]]; then
51+
echo flang
52+
fi
53+
;;
54+
flang-rt)
4755
# Flang is not stable in Windows CI at the moment
4856
if [[ $isForWindows == 0 ]]; then
4957
echo flang
5058
fi
5159
;;
5260
*)
53-
# Nothing to do
61+
echo "${project}"
5462
;;
5563
esac
5664
done
@@ -65,6 +73,11 @@ function compute-runtimes-to-test() {
6573
echo $p
6674
done
6775
;;
76+
flang)
77+
for p in flang-rt; do
78+
echo $p
79+
done
80+
;;
6881
*)
6982
# Nothing to do
7083
;;

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fi
7373
# needs while letting them run on the infrastructure provided by LLVM.
7474

7575
# Figure out which projects need to be built on each platform
76-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
76+
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang flang-rt libc libclc lld lldb llvm mlir openmp polly pstl"
7777
modified_projects="$(keep-modified-projects ${all_projects})"
7878

7979
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))

.ci/metrics/metrics.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,24 @@ def github_get_metrics(
168168
created_at = job.created_at
169169
started_at = job.started_at
170170
completed_at = job.completed_at
171-
queue_time = started_at - created_at
172-
run_time = completed_at - started_at
171+
172+
# GitHub API can return results where the started_at is slightly
173+
# later then the created_at (or completed earlier than started).
174+
# This would cause a -23h59mn delta, which will show up as +24h
175+
# queue/run time on grafana.
176+
if started_at < created_at:
177+
logging.info(
178+
"Workflow {} started before being created.".format(task.id)
179+
)
180+
queue_time = datetime.timedelta(seconds=0)
181+
else:
182+
queue_time = started_at - created_at
183+
if completed_at < started_at:
184+
logging.info("Workflow {} finished before starting.".format(task.id))
185+
run_time = datetime.timedelta(seconds=0)
186+
else:
187+
run_time = completed_at - started_at
188+
173189
if run_time.seconds == 0:
174190
continue
175191

.ci/monolithic-linux.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6565
-D CMAKE_CXX_FLAGS=-gmlt \
6666
-D LLVM_CCACHE_BUILD=ON \
6767
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
68+
-D FLANG_ENABLE_FLANG_RT=OFF \
6869
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
6970

7071
echo "--- ninja"
@@ -95,6 +96,9 @@ if [[ "${runtimes}" != "" ]]; then
9596
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
9697
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
9798
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
99+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
100+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
101+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
98102
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
99103
-D LIBCXX_CXX_ABI=libcxxabi \
100104
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -113,6 +117,9 @@ if [[ "${runtimes}" != "" ]]; then
113117
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
114118
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
115119
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
120+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
121+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
122+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
116123
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
117124
-D LIBCXX_CXX_ABI=libcxxabi \
118125
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -131,6 +138,9 @@ if [[ "${runtimes}" != "" ]]; then
131138
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
132139
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
133140
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
141+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
142+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
143+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
134144
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
135145
-D LIBCXX_CXX_ABI=libcxxabi \
136146
-D CMAKE_BUILD_TYPE=RelWithDebInfo \

bolt/lib/Passes/AsmDump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void dumpFunction(const BinaryFunction &BF) {
143143
std::move(MCEInstance.MCE), std::move(MAB)));
144144
AsmStreamer->initSections(true, *BC.STI);
145145
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
146-
BC.TripleName, "", "", TargetOptions(), std::nullopt));
146+
*BC.TheTriple, "", "", TargetOptions(), std::nullopt));
147147
std::unique_ptr<AsmPrinter> MAP(
148148
BC.TheTarget->createAsmPrinter(*TM, std::move(AsmStreamer)));
149149

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

Lines changed: 22 additions & 3 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;
@@ -31,6 +32,7 @@ constexpr std::array<StringRef, 2> MakeSmartPtrList{
3132
"::std::make_unique",
3233
"::std::make_shared",
3334
};
35+
constexpr StringRef MakeOptional = "::std::make_optional";
3436

3537
} // namespace
3638

@@ -83,9 +85,26 @@ void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
8385
// known template methods in std
8486
callExpr(
8587
argumentCountIs(1),
86-
callee(functionDecl(
87-
matchers::matchesAnyListedName(MakeSmartPtrList),
88-
hasTemplateArgument(0, refersToType(BindOptionalType)))),
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+
89108
hasArgument(0, OptionalDerefMatcher))),
90109
unless(anyOf(hasAncestor(typeLoc()),
91110
hasAncestor(expr(matchers::hasUnevaluatedContext())))))

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ New check aliases
112112
Changes in existing checks
113113
^^^^^^^^^^^^^^^^^^^^^^^^^^
114114

115+
- Improved :doc:`bugprone-optional-value-conversion
116+
<clang-tidy/checks/bugprone/optional-value-conversion>` check to detect
117+
conversion in argument of ``std::make_optional``.
118+
115119
- Improved :doc:`bugprone-string-constructor
116120
<clang-tidy/checks/bugprone/string-constructor>` check to find suspicious
117121
calls of ``std::string`` constructor with char pointer, start position and

clang-tools-extra/test/clang-tidy/checkers/bugprone/optional-value-conversion-construct-from-std.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@ class unique_ptr {};
2727
template <typename type>
2828
class shared_ptr {};
2929

30+
template <typename T>
31+
class initializer_list {};
32+
3033
template <class T, class... Args> unique_ptr<T> make_unique(Args &&...args);
3134
template <class T, class... Args> shared_ptr<T> make_shared(Args &&...args);
3235

36+
template <class T>
37+
constexpr std::optional<__decay(T)> make_optional(T &&value);
38+
template <class T, class... Args>
39+
constexpr std::optional<T> make_optional(Args &&...args);
40+
template <class T, class U, class... Args>
41+
constexpr std::optional<T> make_optional(std::initializer_list<U> il, Args &&...args);
42+
3343
} // namespace std
3444

3545
struct A {
@@ -45,9 +55,12 @@ void invalid() {
4555
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: conversion from 'std::optional<int>' into 'int' and back into 'std::optional<int>', remove potentially error-prone optional dereference [bugprone-optional-value-conversion]
4656
std::make_shared<std::optional<int>>(opt.value());
4757
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: conversion from 'std::optional<int>' into 'int' and back into 'std::optional<int>', remove potentially error-prone optional dereference [bugprone-optional-value-conversion]
58+
std::make_optional(opt.value());
59+
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: conversion from 'std::optional<int>' into 'int' and back into 'std::optional<int>', remove potentially error-prone optional dereference [bugprone-optional-value-conversion]
4860
}
4961

5062
void valid() {
5163
std::make_unique<A>(opt.value());
5264
std::make_shared<A>(opt.value());
65+
std::make_optional<int>(opt.value());
5366
}

clang/AreaTeamMembers.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This is a list of the current Clang Area Team members.
2+
3+
Chair
4+
-----
5+
Aaron Ballman
6+
[email protected] (email), AaronBallman (Discourse), AaronBallman (GitHub), AaronBallman (Discord)
7+
8+
Secretary
9+
---------
10+
Reid Kleckner
11+
[email protected] (email), rnk (Discourse), rnk (GitHub), rnk (Discord)
12+
13+
Other Members
14+
-------------
15+
Eli Friedman
16+
[email protected]> (email), efriedma-quic (Discourse), efriedma-quic (GitHub)
17+

clang/Maintainers.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Clang Maintainers
44

55
This file is a list of the
66
`maintainers <https://llvm.org/docs/DeveloperPolicy.html#maintainers>`_ for
7-
Clang.
7+
Clang. The list of current Clang Area Team members can be found
8+
`here <https://github.com/llvm/llvm-project/blob/main/clang/AreaTeamMembers.txt>`_.
89

910
.. contents::
1011
:depth: 2

0 commit comments

Comments
 (0)