Skip to content

Commit ad6726d

Browse files
committed
Merge branch 'main' into users/chapuni/cov/merge/mcdcsort-base
2 parents 85b1602 + 9709795 commit ad6726d

File tree

1,475 files changed

+74233
-31778
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,475 files changed

+74233
-31778
lines changed

.github/new-prs-labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,11 @@ backend:DirectX:
661661

662662
backend:SPIR-V:
663663
- clang/lib/Driver/ToolChains/SPIRV.*
664+
- clang/lib/Sema/SemaSPIRV.cpp
665+
- clang/include/clang/Sema/SemaSPIRV.h
666+
- clang/include/clang/Basic/BuiltinsSPIRV.td
667+
- clang/test/CodeGenSPIRV/**
668+
- clang/test/SemaSPIRV/**
664669
- llvm/lib/Target/SPIRV/**
665670
- llvm/test/CodeGen/SPIRV/**
666671
- llvm/test/Frontend/HLSL/**

.github/workflows/build-ci-container.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ jobs:
5959

6060
- name: Test Container
6161
run: |
62-
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
63-
podman run --rm -it $image /usr/bin/bash -x -c 'cd $HOME && printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
62+
for image in ${{ steps.vars.outputs.container-name-tag }}; do
63+
# Use --pull=never to ensure we are testing the just built image.
64+
podman run --pull=never --rm -it $image /usr/bin/bash -x -c 'cd $HOME && printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
6465
done
6566
6667
push-ci-container:

.github/workflows/new-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: llvm/actions/issue-labeler@main
1717
with:
18-
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
1919
configuration-path: .github/new-issues-labeler.yml
2020
include-title: 1
2121
include-body: 0

.github/workflows/release-binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
8484
shell: bash
8585
run: |
86-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
86+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions
8787
8888
- name: Collect Variables
8989
id: vars
@@ -102,8 +102,8 @@ jobs:
102102
release_version="$trimmed"
103103
ref="llvmorg-$release_version"
104104
else
105-
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-${{ github.sha }}"
106-
ref=${{ github.sha }}
105+
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-$GITHUB_SHA"
106+
ref="$GITHUB_SHA"
107107
fi
108108
if [ -n "${{ inputs.upload }}" ]; then
109109
upload="${{ inputs.upload }}"
@@ -114,20 +114,20 @@ jobs:
114114
echo "ref=$ref" >> $GITHUB_OUTPUT
115115
echo "upload=$upload" >> $GITHUB_OUTPUT
116116
117-
release_binary_basename="LLVM-$release_version-${{ runner.os }}-${{ runner.arch }}"
117+
release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
118118
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
119119
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
120120
121121
# Detect necessary CMake flags
122-
target="${{ runner.os }}-${{ runner.arch }}"
122+
target="$RUNNER_OS-$RUNNER_ARCH"
123123
echo "enable-pgo=false" >> $GITHUB_OUTPUT
124124
target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF"
125125
# The macOS builds try to cross compile some libraries so we need to
126126
# add extra CMake args to disable them.
127127
# See https://github.com/llvm/llvm-project/issues/99767
128-
if [ "${{ runner.os }}" = "macOS" ]; then
128+
if [ "$RUNNER_OS" = "macOS" ]; then
129129
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
130-
if [ "${{ runner.arch }}" = "ARM64" ]; then
130+
if [ "$RUNNER_ARCH" = "ARM64" ]; then
131131
arches=arm64
132132
else
133133
arches=x86_64
@@ -137,7 +137,7 @@ jobs:
137137
138138
build_flang="true"
139139
140-
if [ "${{ runner.os }}" = "Windows" ]; then
140+
if [ "$RUNNER_OS" = "Windows" ]; then
141141
# The build times out on Windows, so we need to disable LTO.
142142
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
143143
fi

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,13 @@ BreakFunctionNames("break-funcs",
4646
cl::Hidden,
4747
cl::cat(BoltCategory));
4848

49-
cl::list<std::string>
50-
FunctionPadSpec("pad-funcs", cl::CommaSeparated,
51-
cl::desc("list of functions to pad with amount of bytes"),
52-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
53-
cl::Hidden, cl::cat(BoltCategory));
54-
55-
cl::list<std::string> FunctionPadBeforeSpec(
56-
"pad-funcs-before", cl::CommaSeparated,
57-
cl::desc("list of functions to pad with amount of bytes"),
58-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."), cl::Hidden,
59-
cl::cat(BoltCategory));
49+
static cl::list<std::string>
50+
FunctionPadSpec("pad-funcs",
51+
cl::CommaSeparated,
52+
cl::desc("list of functions to pad with amount of bytes"),
53+
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
54+
cl::Hidden,
55+
cl::cat(BoltCategory));
6056

6157
static cl::opt<bool> MarkFuncs(
6258
"mark-funcs",
@@ -74,12 +70,11 @@ X86AlignBranchBoundaryHotOnly("x86-align-branch-boundary-hot-only",
7470
cl::init(true),
7571
cl::cat(BoltOptCategory));
7672

77-
size_t padFunction(const cl::list<std::string> &Spec,
78-
const BinaryFunction &Function) {
73+
size_t padFunction(const BinaryFunction &Function) {
7974
static std::map<std::string, size_t> FunctionPadding;
8075

81-
if (FunctionPadding.empty() && !Spec.empty()) {
82-
for (const std::string &Spec : Spec) {
76+
if (FunctionPadding.empty() && !FunctionPadSpec.empty()) {
77+
for (std::string &Spec : FunctionPadSpec) {
8378
size_t N = Spec.find(':');
8479
if (N == std::string::npos)
8580
continue;
@@ -324,32 +319,6 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
324319
Streamer.emitCodeAlignment(Function.getAlign(), &*BC.STI);
325320
}
326321

327-
if (size_t Padding =
328-
opts::padFunction(opts::FunctionPadBeforeSpec, Function)) {
329-
// Handle padFuncsBefore after the above alignment logic but before
330-
// symbol addresses are decided.
331-
if (!BC.HasRelocations) {
332-
BC.errs() << "BOLT-ERROR: -pad-before-funcs is not supported in "
333-
<< "non-relocation mode\n";
334-
exit(1);
335-
}
336-
337-
// Preserve Function.getMinAlign().
338-
if (!isAligned(Function.getMinAlign(), Padding)) {
339-
BC.errs() << "BOLT-ERROR: user-requested " << Padding
340-
<< " padding bytes before function " << Function
341-
<< " is not a multiple of the minimum function alignment ("
342-
<< Function.getMinAlign().value() << ").\n";
343-
exit(1);
344-
}
345-
346-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding before function " << Function
347-
<< " with " << Padding << " bytes\n");
348-
349-
// Since the padding is not executed, it can be null bytes.
350-
Streamer.emitFill(Padding, 0);
351-
}
352-
353322
MCContext &Context = Streamer.getContext();
354323
const MCAsmInfo *MAI = Context.getAsmInfo();
355324

@@ -404,7 +373,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
404373
emitFunctionBody(Function, FF, /*EmitCodeOnly=*/false);
405374

406375
// Emit padding if requested.
407-
if (size_t Padding = opts::padFunction(opts::FunctionPadSpec, Function)) {
376+
if (size_t Padding = opts::padFunction(Function)) {
408377
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding function " << Function << " with "
409378
<< Padding << " bytes\n");
410379
Streamer.emitFill(Padding, MAI->getTextAlignFillValue());

bolt/lib/Passes/ReorderFunctions.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ extern cl::OptionCategory BoltOptCategory;
2828
extern cl::opt<unsigned> Verbosity;
2929
extern cl::opt<uint32_t> RandomSeed;
3030

31-
extern size_t padFunction(const cl::list<std::string> &Spec,
32-
const bolt::BinaryFunction &Function);
33-
extern cl::list<std::string> FunctionPadSpec, FunctionPadBeforeSpec;
31+
extern size_t padFunction(const bolt::BinaryFunction &Function);
3432

3533
extern cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions;
3634
cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions(
@@ -306,12 +304,8 @@ Error ReorderFunctions::runOnFunctions(BinaryContext &BC) {
306304
return false;
307305
if (B->isIgnored())
308306
return true;
309-
const size_t PadA =
310-
opts::padFunction(opts::FunctionPadSpec, *A) +
311-
opts::padFunction(opts::FunctionPadBeforeSpec, *A);
312-
const size_t PadB =
313-
opts::padFunction(opts::FunctionPadSpec, *B) +
314-
opts::padFunction(opts::FunctionPadBeforeSpec, *B);
307+
const size_t PadA = opts::padFunction(*A);
308+
const size_t PadB = opts::padFunction(*B);
315309
if (!PadA || !PadB) {
316310
if (PadA)
317311
return true;

bolt/test/AArch64/pad-before-funcs.s

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

clang-tools-extra/clang-tidy/ClangTidyCheck.cpp

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "ClangTidyCheck.h"
10-
#include "llvm/ADT/SmallString.h"
1110
#include "llvm/ADT/StringRef.h"
12-
#include "llvm/Support/Error.h"
11+
#include "llvm/ADT/StringSet.h"
1312
#include "llvm/Support/YAMLParser.h"
1413
#include <optional>
14+
#include <string>
1515

1616
namespace clang::tidy {
1717

@@ -62,16 +62,29 @@ ClangTidyCheck::OptionsView::get(StringRef LocalName) const {
6262
return std::nullopt;
6363
}
6464

65+
static const llvm::StringSet<> DeprecatedGlobalOptions{
66+
"StrictMode",
67+
"IgnoreMacros",
68+
};
69+
6570
static ClangTidyOptions::OptionMap::const_iterator
6671
findPriorityOption(const ClangTidyOptions::OptionMap &Options,
6772
StringRef NamePrefix, StringRef LocalName,
68-
llvm::StringSet<> *Collector) {
73+
ClangTidyContext *Context) {
74+
llvm::StringSet<> *Collector = Context->getOptionsCollector();
6975
if (Collector) {
7076
Collector->insert((NamePrefix + LocalName).str());
7177
Collector->insert(LocalName);
7278
}
7379
auto IterLocal = Options.find((NamePrefix + LocalName).str());
7480
auto IterGlobal = Options.find(LocalName);
81+
// FIXME: temporary solution for deprecation warnings, should be removed
82+
// after 22.x. Warn configuration deps on deprecation global options.
83+
if (IterLocal == Options.end() && IterGlobal != Options.end() &&
84+
DeprecatedGlobalOptions.contains(LocalName))
85+
Context->configurationDiag(
86+
"global option '%0' is deprecated, please use '%1%0' instead.")
87+
<< LocalName << NamePrefix;
7588
if (IterLocal == Options.end())
7689
return IterGlobal;
7790
if (IterGlobal == Options.end())
@@ -83,8 +96,7 @@ findPriorityOption(const ClangTidyOptions::OptionMap &Options,
8396

8497
std::optional<StringRef>
8598
ClangTidyCheck::OptionsView::getLocalOrGlobal(StringRef LocalName) const {
86-
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName,
87-
Context->getOptionsCollector());
99+
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName, Context);
88100
if (Iter != CheckOptions.end())
89101
return StringRef(Iter->getValue().Value);
90102
return std::nullopt;
@@ -117,8 +129,7 @@ ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName) const {
117129
template <>
118130
std::optional<bool>
119131
ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName) const {
120-
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName,
121-
Context->getOptionsCollector());
132+
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName, Context);
122133
if (Iter != CheckOptions.end()) {
123134
if (auto Result = getAsBool(Iter->getValue().Value, Iter->getKey()))
124135
return Result;
@@ -157,10 +168,9 @@ std::optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
157168
bool IgnoreCase) const {
158169
if (!CheckGlobal && Context->getOptionsCollector())
159170
Context->getOptionsCollector()->insert((NamePrefix + LocalName).str());
160-
auto Iter = CheckGlobal
161-
? findPriorityOption(CheckOptions, NamePrefix, LocalName,
162-
Context->getOptionsCollector())
163-
: CheckOptions.find((NamePrefix + LocalName).str());
171+
auto Iter = CheckGlobal ? findPriorityOption(CheckOptions, NamePrefix,
172+
LocalName, Context)
173+
: CheckOptions.find((NamePrefix + LocalName).str());
164174
if (Iter == CheckOptions.end())
165175
return std::nullopt;
166176

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "../ClangTidy.h"
1010
#include "../ClangTidyModule.h"
1111
#include "../ClangTidyModuleRegistry.h"
12-
#include "../cppcoreguidelines/NarrowingConversionsCheck.h"
1312
#include "ArgumentCommentCheck.h"
1413
#include "AssertSideEffectCheck.h"
1514
#include "AssignmentInIfConditionCheck.h"
@@ -47,6 +46,7 @@
4746
#include "MultiLevelImplicitPointerConversionCheck.h"
4847
#include "MultipleNewInOneExpressionCheck.h"
4948
#include "MultipleStatementMacroCheck.h"
49+
#include "NarrowingConversionsCheck.h"
5050
#include "NoEscapeCheck.h"
5151
#include "NonZeroEnumToBoolConversionCheck.h"
5252
#include "NondeterministicPointerIterationOrderCheck.h"
@@ -183,7 +183,7 @@ class BugproneModule : public ClangTidyModule {
183183
"bugprone-pointer-arithmetic-on-polymorphic-object");
184184
CheckFactories.registerCheck<RedundantBranchConditionCheck>(
185185
"bugprone-redundant-branch-condition");
186-
CheckFactories.registerCheck<cppcoreguidelines::NarrowingConversionsCheck>(
186+
CheckFactories.registerCheck<NarrowingConversionsCheck>(
187187
"bugprone-narrowing-conversions");
188188
CheckFactories.registerCheck<NoEscapeCheck>("bugprone-no-escape");
189189
CheckFactories.registerCheck<NonZeroEnumToBoolConversionCheck>(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ add_clang_library(clangTidyBugproneModule STATIC
4242
MultiLevelImplicitPointerConversionCheck.cpp
4343
MultipleNewInOneExpressionCheck.cpp
4444
MultipleStatementMacroCheck.cpp
45+
NarrowingConversionsCheck.cpp
4546
NoEscapeCheck.cpp
4647
NonZeroEnumToBoolConversionCheck.cpp
4748
NondeterministicPointerIterationOrderCheck.cpp
@@ -95,7 +96,6 @@ add_clang_library(clangTidyBugproneModule STATIC
9596

9697
LINK_LIBS
9798
clangTidy
98-
clangTidyCppCoreGuidelinesModule
9999
clangTidyUtils
100100

101101
DEPENDS

clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp renamed to clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
using namespace clang::ast_matchers;
2424

25-
namespace clang::tidy::cppcoreguidelines {
25+
namespace clang::tidy::bugprone {
2626

2727
namespace {
2828

@@ -614,4 +614,4 @@ void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) {
614614
return handleImplicitCast(*Result.Context, *Cast);
615615
llvm_unreachable("must be binary operator or cast expression");
616616
}
617-
} // namespace clang::tidy::cppcoreguidelines
617+
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h renamed to clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_NARROWING_CONVERSIONS_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_NARROWING_CONVERSIONS_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NARROWING_CONVERSIONS_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NARROWING_CONVERSIONS_H
1111

1212
#include "../ClangTidyCheck.h"
1313

14-
namespace clang::tidy::cppcoreguidelines {
14+
namespace clang::tidy::bugprone {
1515

1616
/// Checks for narrowing conversions, e.g:
1717
/// int i = 0;
1818
/// i += 0.1;
1919
///
2020
/// For the user-facing documentation see:
21-
/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/narrowing-conversions.html
21+
/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/narrowing-conversions.html
2222
class NarrowingConversionsCheck : public ClangTidyCheck {
2323
public:
2424
NarrowingConversionsCheck(StringRef Name, ClangTidyContext *Context);
@@ -104,6 +104,6 @@ class NarrowingConversionsCheck : public ClangTidyCheck {
104104
const bool PedanticMode;
105105
};
106106

107-
} // namespace clang::tidy::cppcoreguidelines
107+
} // namespace clang::tidy::bugprone
108108

109-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_NARROWING_CONVERSIONS_H
109+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NARROWING_CONVERSIONS_H

0 commit comments

Comments
 (0)