Skip to content

Commit 4b9a0e3

Browse files
Merge branch 'main' into fp16-fptrunc-fpext-lowering
2 parents 416faa8 + 36bc9b7 commit 4b9a0e3

File tree

851 files changed

+162034
-34705
lines changed

Some content is hidden

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

851 files changed

+162034
-34705
lines changed

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
ARG LLVM_VERSION=21.1.0
2+
# FIXME: Use "${LLVM_VERSION%%.*}" instead of "LLVM_VERSION_MAJOR" once we update runners to Ubuntu-26.04 with Buildah >= 1.37
3+
ARG LLVM_VERSION_MAJOR=21
24

35
FROM docker.io/library/ubuntu:24.04 AS llvm-downloader
46
ARG LLVM_VERSION
7+
ARG LLVM_VERSION_MAJOR
58

69
RUN apt-get update && \
710
apt-get install -y wget xz-utils && \
811
wget -O llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
912
mkdir -p /llvm-extract && \
1013
tar -xvJf llvm.tar.xz -C /llvm-extract \
1114
# Only unpack these tools to save space on Github runner.
15+
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
16+
LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
1217
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
1318
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
1419
LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
@@ -50,12 +55,27 @@ RUN pip install -r requirements_formatting.txt --break-system-packages && \
5055

5156
FROM base AS ci-container-code-lint
5257
ARG LLVM_VERSION
58+
ARG LLVM_VERSION_MAJOR
5359

54-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
60+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
61+
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
62+
${LLVM_SYSROOT}/bin/
63+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
64+
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
5565
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
5666

67+
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
68+
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
69+
5770
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5871

72+
RUN apt-get update && \
73+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
74+
cmake \
75+
ninja-build && \
76+
apt-get clean && \
77+
rm -rf /var/lib/apt/lists/*
78+
5979
# Install dependencies for 'pr-code-lint.yml' job
6080
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
6181
RUN pip install -r requirements_linting.txt --break-system-packages && \

.github/workflows/premerge.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
with:
6363
fetch-depth: 2
6464
- name: Build and Test
65+
timeout-minutes: 120
6566
continue-on-error: ${{ runner.arch == 'ARM64' }}
6667
run: |
6768
git config --global --add safe.directory '*'
@@ -149,6 +150,7 @@ jobs:
149150
echo "windows-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
150151
echo "windows-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
151152
- name: Build and Test
153+
timeout-minutes: 180
152154
if: ${{ steps.vars.outputs.windows-projects != '' }}
153155
shell: cmd
154156
run: |

clang-tools-extra/clang-doc/Generators.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,11 @@ void Generator::addInfoToIndex(Index &Idx, const doc::Info *Info) {
9797

9898
// This anchor is used to force the linker to link in the generated object file
9999
// and thus register the generators.
100-
static int LLVM_ATTRIBUTE_UNUSED YAMLGeneratorAnchorDest =
101-
YAMLGeneratorAnchorSource;
102-
static int LLVM_ATTRIBUTE_UNUSED MDGeneratorAnchorDest =
103-
MDGeneratorAnchorSource;
104-
static int LLVM_ATTRIBUTE_UNUSED HTMLGeneratorAnchorDest =
105-
HTMLGeneratorAnchorSource;
106-
static int LLVM_ATTRIBUTE_UNUSED MHTMLGeneratorAnchorDest =
100+
[[maybe_unused]] static int YAMLGeneratorAnchorDest = YAMLGeneratorAnchorSource;
101+
[[maybe_unused]] static int MDGeneratorAnchorDest = MDGeneratorAnchorSource;
102+
[[maybe_unused]] static int HTMLGeneratorAnchorDest = HTMLGeneratorAnchorSource;
103+
[[maybe_unused]] static int MHTMLGeneratorAnchorDest =
107104
MHTMLGeneratorAnchorSource;
108-
static int LLVM_ATTRIBUTE_UNUSED JSONGeneratorAnchorDest =
109-
JSONGeneratorAnchorSource;
105+
[[maybe_unused]] static int JSONGeneratorAnchorDest = JSONGeneratorAnchorSource;
110106
} // namespace doc
111107
} // namespace clang

clang-tools-extra/clang-tidy/ClangTidyForceLinker.h

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,132 +16,131 @@ namespace clang::tidy {
1616

1717
// This anchor is used to force the linker to link the AbseilModule.
1818
extern volatile int AbseilModuleAnchorSource;
19-
static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
19+
[[maybe_unused]] static int AbseilModuleAnchorDestination =
2020
AbseilModuleAnchorSource;
2121

2222
// This anchor is used to force the linker to link the AlteraModule.
2323
extern volatile int AlteraModuleAnchorSource;
24-
static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
24+
[[maybe_unused]] static int AlteraModuleAnchorDestination =
2525
AlteraModuleAnchorSource;
2626

2727
// This anchor is used to force the linker to link the AndroidModule.
2828
extern volatile int AndroidModuleAnchorSource;
29-
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
29+
[[maybe_unused]] static int AndroidModuleAnchorDestination =
3030
AndroidModuleAnchorSource;
3131

3232
// This anchor is used to force the linker to link the BoostModule.
3333
extern volatile int BoostModuleAnchorSource;
34-
static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
34+
[[maybe_unused]] static int BoostModuleAnchorDestination =
3535
BoostModuleAnchorSource;
3636

3737
// This anchor is used to force the linker to link the BugproneModule.
3838
extern volatile int BugproneModuleAnchorSource;
39-
static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination =
39+
[[maybe_unused]] static int BugproneModuleAnchorDestination =
4040
BugproneModuleAnchorSource;
4141

4242
// This anchor is used to force the linker to link the CERTModule.
4343
extern volatile int CERTModuleAnchorSource;
44-
static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
44+
[[maybe_unused]] static int CERTModuleAnchorDestination =
4545
CERTModuleAnchorSource;
4646

4747
// This anchor is used to force the linker to link the ConcurrencyModule.
4848
extern volatile int ConcurrencyModuleAnchorSource;
49-
static int LLVM_ATTRIBUTE_UNUSED ConcurrencyModuleAnchorDestination =
49+
[[maybe_unused]] static int ConcurrencyModuleAnchorDestination =
5050
ConcurrencyModuleAnchorSource;
5151

5252
// This anchor is used to force the linker to link the CppCoreGuidelinesModule.
5353
extern volatile int CppCoreGuidelinesModuleAnchorSource;
54-
static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
54+
[[maybe_unused]] static int CppCoreGuidelinesModuleAnchorDestination =
5555
CppCoreGuidelinesModuleAnchorSource;
5656

5757
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
5858
// This anchor is used to force the linker to link the CustomModule.
5959
extern volatile int CustomModuleAnchorSource;
60-
static int LLVM_ATTRIBUTE_UNUSED CustomModuleAnchorDestination =
60+
[[maybe_unused]] static int CustomModuleAnchorDestination =
6161
CustomModuleAnchorSource;
6262
#endif
6363

6464
// This anchor is used to force the linker to link the DarwinModule.
6565
extern volatile int DarwinModuleAnchorSource;
66-
static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
66+
[[maybe_unused]] static int DarwinModuleAnchorDestination =
6767
DarwinModuleAnchorSource;
6868

6969
// This anchor is used to force the linker to link the FuchsiaModule.
7070
extern volatile int FuchsiaModuleAnchorSource;
71-
static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
71+
[[maybe_unused]] static int FuchsiaModuleAnchorDestination =
7272
FuchsiaModuleAnchorSource;
7373

7474
// This anchor is used to force the linker to link the GoogleModule.
7575
extern volatile int GoogleModuleAnchorSource;
76-
static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
76+
[[maybe_unused]] static int GoogleModuleAnchorDestination =
7777
GoogleModuleAnchorSource;
7878

7979
// This anchor is used to force the linker to link the HICPPModule.
8080
extern volatile int HICPPModuleAnchorSource;
81-
static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
81+
[[maybe_unused]] static int HICPPModuleAnchorDestination =
8282
HICPPModuleAnchorSource;
8383

8484
// This anchor is used to force the linker to link the LinuxKernelModule.
8585
extern volatile int LinuxKernelModuleAnchorSource;
86-
static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination =
86+
[[maybe_unused]] static int LinuxKernelModuleAnchorDestination =
8787
LinuxKernelModuleAnchorSource;
8888

8989
// This anchor is used to force the linker to link the LLVMModule.
9090
extern volatile int LLVMModuleAnchorSource;
91-
static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
91+
[[maybe_unused]] static int LLVMModuleAnchorDestination =
9292
LLVMModuleAnchorSource;
9393

9494
// This anchor is used to force the linker to link the LLVMLibcModule.
9595
extern volatile int LLVMLibcModuleAnchorSource;
96-
static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination =
96+
[[maybe_unused]] static int LLVMLibcModuleAnchorDestination =
9797
LLVMLibcModuleAnchorSource;
9898

9999
// This anchor is used to force the linker to link the MiscModule.
100100
extern volatile int MiscModuleAnchorSource;
101-
static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
101+
[[maybe_unused]] static int MiscModuleAnchorDestination =
102102
MiscModuleAnchorSource;
103103

104104
// This anchor is used to force the linker to link the ModernizeModule.
105105
extern volatile int ModernizeModuleAnchorSource;
106-
static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
106+
[[maybe_unused]] static int ModernizeModuleAnchorDestination =
107107
ModernizeModuleAnchorSource;
108108

109109
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER && \
110110
!defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
111111
// This anchor is used to force the linker to link the MPIModule.
112112
extern volatile int MPIModuleAnchorSource;
113-
static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
114-
MPIModuleAnchorSource;
113+
[[maybe_unused]] static int MPIModuleAnchorDestination = MPIModuleAnchorSource;
115114
#endif
116115

117116
// This anchor is used to force the linker to link the ObjCModule.
118117
extern volatile int ObjCModuleAnchorSource;
119-
static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination =
118+
[[maybe_unused]] static int ObjCModuleAnchorDestination =
120119
ObjCModuleAnchorSource;
121120

122121
// This anchor is used to force the linker to link the OpenMPModule.
123122
extern volatile int OpenMPModuleAnchorSource;
124-
static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination =
123+
[[maybe_unused]] static int OpenMPModuleAnchorDestination =
125124
OpenMPModuleAnchorSource;
126125

127126
// This anchor is used to force the linker to link the PerformanceModule.
128127
extern volatile int PerformanceModuleAnchorSource;
129-
static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination =
128+
[[maybe_unused]] static int PerformanceModuleAnchorDestination =
130129
PerformanceModuleAnchorSource;
131130

132131
// This anchor is used to force the linker to link the PortabilityModule.
133132
extern volatile int PortabilityModuleAnchorSource;
134-
static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination =
133+
[[maybe_unused]] static int PortabilityModuleAnchorDestination =
135134
PortabilityModuleAnchorSource;
136135

137136
// This anchor is used to force the linker to link the ReadabilityModule.
138137
extern volatile int ReadabilityModuleAnchorSource;
139-
static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
138+
[[maybe_unused]] static int ReadabilityModuleAnchorDestination =
140139
ReadabilityModuleAnchorSource;
141140

142141
// This anchor is used to force the linker to link the ZirconModule.
143142
extern volatile int ZirconModuleAnchorSource;
144-
static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
143+
[[maybe_unused]] static int ZirconModuleAnchorDestination =
145144
ZirconModuleAnchorSource;
146145

147146
} // namespace clang::tidy

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ template <> struct ScalarEnumerationTraits<clang::DiagnosticIDs::Level> {
154154
}
155155
};
156156
template <> struct SequenceElementTraits<ClangTidyOptions::CustomCheckDiag> {
157+
// NOLINTNEXTLINE(readability-identifier-naming) Defined by YAMLTraits.h
157158
static const bool flow = false;
158159
};
159160
template <> struct MappingTraits<ClangTidyOptions::CustomCheckDiag> {
@@ -165,6 +166,7 @@ template <> struct MappingTraits<ClangTidyOptions::CustomCheckDiag> {
165166
}
166167
};
167168
template <> struct SequenceElementTraits<ClangTidyOptions::CustomCheckValue> {
169+
// NOLINTNEXTLINE(readability-identifier-naming) Defined by YAMLTraits.h
168170
static const bool flow = false;
169171
};
170172
template <> struct MappingTraits<ClangTidyOptions::CustomCheckValue> {

clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ struct StrCatCheckResult {
4545
std::vector<FixItHint> Hints;
4646
};
4747

48-
void removeCallLeaveArgs(const CallExpr *Call, StrCatCheckResult *CheckResult) {
48+
} // namespace
49+
50+
static void removeCallLeaveArgs(const CallExpr *Call,
51+
StrCatCheckResult *CheckResult) {
4952
if (Call->getNumArgs() == 0)
5053
return;
5154
// Remove 'Foo('
@@ -58,9 +61,9 @@ void removeCallLeaveArgs(const CallExpr *Call, StrCatCheckResult *CheckResult) {
5861
Call->getRParenLoc(), Call->getEndLoc().getLocWithOffset(1))));
5962
}
6063

61-
const clang::CallExpr *processArgument(const Expr *Arg,
62-
const MatchFinder::MatchResult &Result,
63-
StrCatCheckResult *CheckResult) {
64+
static const clang::CallExpr *
65+
processArgument(const Expr *Arg, const MatchFinder::MatchResult &Result,
66+
StrCatCheckResult *CheckResult) {
6467
const auto IsAlphanum = hasDeclaration(cxxMethodDecl(hasName("AlphaNum")));
6568
static const auto *const Strcat = new auto(hasName("::absl::StrCat"));
6669
const auto IsStrcat = cxxBindTemporaryExpr(
@@ -78,8 +81,8 @@ const clang::CallExpr *processArgument(const Expr *Arg,
7881
return nullptr;
7982
}
8083

81-
StrCatCheckResult processCall(const CallExpr *RootCall, bool IsAppend,
82-
const MatchFinder::MatchResult &Result) {
84+
static StrCatCheckResult processCall(const CallExpr *RootCall, bool IsAppend,
85+
const MatchFinder::MatchResult &Result) {
8386
StrCatCheckResult CheckResult;
8487
std::deque<const CallExpr *> CallsToProcess = {RootCall};
8588

@@ -101,7 +104,6 @@ StrCatCheckResult processCall(const CallExpr *RootCall, bool IsAppend,
101104
}
102105
return CheckResult;
103106
}
104-
} // namespace
105107

106108
void RedundantStrcatCallsCheck::check(const MatchFinder::MatchResult &Result) {
107109
bool IsAppend = false;

clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement,
215215
break;
216216
case (BO_MulAssign):
217217
Iterations =
218-
1 + (std::log((double)EndValue) - std::log((double)InitValue)) /
219-
std::log((double)ConstantValue);
218+
1 + ((std::log((double)EndValue) - std::log((double)InitValue)) /
219+
std::log((double)ConstantValue));
220220
break;
221221
case (BO_DivAssign):
222222
Iterations =
223-
1 + (std::log((double)InitValue) - std::log((double)EndValue)) /
224-
std::log((double)ConstantValue);
223+
1 + ((std::log((double)InitValue) - std::log((double)EndValue)) /
224+
std::log((double)ConstantValue));
225225
break;
226226
default:
227227
// All other operators are not handled; assume large bounds.

clang-tools-extra/clang-tidy/android/CloexecCheck.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ using namespace clang::ast_matchers;
1616

1717
namespace clang::tidy::android {
1818

19-
namespace {
2019
// Helper function to form the correct string mode for Type3.
2120
// Build the replace text. If it's string constant, add <Mode> directly in the
2221
// end of the string. Else, add <Mode>.
23-
std::string buildFixMsgForStringFlag(const Expr *Arg, const SourceManager &SM,
24-
const LangOptions &LangOpts, char Mode) {
22+
static std::string buildFixMsgForStringFlag(const Expr *Arg,
23+
const SourceManager &SM,
24+
const LangOptions &LangOpts,
25+
char Mode) {
2526
if (Arg->getBeginLoc().isMacroID())
2627
return (Lexer::getSourceText(
2728
CharSourceRange::getTokenRange(Arg->getSourceRange()), SM,
@@ -32,11 +33,6 @@ std::string buildFixMsgForStringFlag(const Expr *Arg, const SourceManager &SM,
3233
StringRef SR = cast<StringLiteral>(Arg->IgnoreParenCasts())->getString();
3334
return ("\"" + SR + Twine(Mode) + "\"").str();
3435
}
35-
} // namespace
36-
37-
const char *CloexecCheck::FuncDeclBindingStr = "funcDecl";
38-
39-
const char *CloexecCheck::FuncBindingStr = "func";
4036

4137
void CloexecCheck::registerMatchersImpl(
4238
MatchFinder *Finder, internal::Matcher<FunctionDecl> Function) {

clang-tools-extra/clang-tidy/android/CloexecCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ class CloexecCheck : public ClangTidyCheck {
8989
int N) const;
9090

9191
/// Binding name of the FuncDecl of a function call.
92-
static const char *FuncDeclBindingStr;
92+
static constexpr char FuncDeclBindingStr[] = "funcDecl";
9393

9494
/// Binding name of the function call expression.
95-
static const char *FuncBindingStr;
95+
static constexpr char FuncBindingStr[] = "func";
9696
};
9797

9898
} // namespace clang::tidy::android

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ approximateStandardConversionSequence(const TheCheck &Check, QualType From,
10741074
WorkType = To;
10751075
}
10761076

1077-
if (Ctx.hasSameType(WorkType, To)) {
1077+
if (ASTContext::hasSameType(WorkType, To)) {
10781078
LLVM_DEBUG(llvm::dbgs() << "<<< approximateStdConv. Reached 'To' type.\n");
10791079
return {Ctx.getCommonSugaredType(WorkType, To)};
10801080
}

0 commit comments

Comments
 (0)