Skip to content

Commit 6ce7fe5

Browse files
authored
Merge branch 'main' into shay-kl/fix-tensor-padop-indexing
2 parents 41151d6 + 491619a commit 6ce7fe5

File tree

591 files changed

+37738
-20041
lines changed

Some content is hidden

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

591 files changed

+37738
-20041
lines changed

.ci/generate_test_report_lib.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ def plural(num_tests):
122122
]
123123
)
124124

125+
if failures or return_code != 0:
126+
report.extend(
127+
[
128+
"",
129+
"If these failures are unrelated to your changes (for example "
130+
"tests are broken or flaky at HEAD), please open an issue at "
131+
"https://github.com/llvm/llvm-project/issues and add the "
132+
"`infrastructure` label.",
133+
]
134+
)
135+
125136
report = "\n".join(report)
126137
if len(report.encode("utf-8")) > size_limit:
127138
return generate_report(

.ci/generate_test_report_lib_test.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ def test_no_failures_build_failed(self):
109109
110110
All tests passed but another part of the build **failed**.
111111
112-
[Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details."""
112+
[Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details.
113+
114+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
113115
),
114116
"error",
115117
),
@@ -169,7 +171,9 @@ def test_report_single_file_single_testsuite(self):
169171
```
170172
Other output goes here
171173
```
172-
</details>"""
174+
</details>
175+
176+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
173177
),
174178
"error",
175179
),
@@ -203,7 +207,9 @@ def test_report_single_file_single_testsuite(self):
203207
```
204208
DEF/test_2 output goes here
205209
```
206-
</details>"""
210+
</details>
211+
212+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
207213
),
208214
"error",
209215
)
@@ -311,7 +317,9 @@ def test_report_dont_list_failures(self):
311317
312318
* 1 test failed
313319
314-
Failed tests and their output was too large to report. Download the build's log file to see the details."""
320+
Failed tests and their output was too large to report. Download the build's log file to see the details.
321+
322+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
315323
),
316324
"error",
317325
),
@@ -352,13 +360,16 @@ def test_report_dont_list_failures_link_to_log(self):
352360
353361
* 1 test failed
354362
355-
Failed tests and their output was too large to report. [Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details."""
363+
Failed tests and their output was too large to report. [Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details.
364+
365+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
356366
),
357367
"error",
358368
),
359369
)
360370

361371
def test_report_size_limit(self):
372+
test_output = "f" * 1000
362373
self.assertEqual(
363374
generate_test_report_lib.generate_report(
364375
"Foo",
@@ -371,14 +382,16 @@ def test_report_size_limit(self):
371382
<testsuites time="0.02">
372383
<testsuite name="Bar" tests="1" failures="1" skipped="0" time="0.02">
373384
<testcase classname="Bar/test_1" name="test_1" time="0.02">
374-
<failure><![CDATA[Some long output goes here...]]></failure>
385+
<failure><![CDATA[{output}]]></failure>
375386
</testcase>
376387
</testsuite>
377-
</testsuites>"""
388+
</testsuites>""".format(
389+
output=test_output
390+
)
378391
)
379392
)
380393
],
381-
size_limit=128,
394+
size_limit=512,
382395
),
383396
(
384397
dedent(
@@ -387,7 +400,9 @@ def test_report_size_limit(self):
387400
388401
* 1 test failed
389402
390-
Failed tests and their output was too large to report. Download the build's log file to see the details."""
403+
Failed tests and their output was too large to report. Download the build's log file to see the details.
404+
405+
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
391406
),
392407
"error",
393408
),

bolt/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ if(BOLT_BUILT_STANDALONE)
4646
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
4747
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
4848

49+
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
50+
add_definitions(${LLVM_DEFINITIONS_LIST})
51+
list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
52+
4953
include(AddLLVM)
5054
include(TableGen)
5155
include_directories(${LLVM_INCLUDE_DIRS})

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
201201

202202
std::string Error;
203203
const Target *TheTarget =
204-
TargetRegistry::lookupTarget(std::string(ArchName), TheTriple, Error);
204+
TargetRegistry::lookupTarget(ArchName, TheTriple, Error);
205205
if (!TheTarget)
206206
return createStringError(make_error_code(std::errc::not_supported),
207207
Twine("BOLT-ERROR: ", Error));

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@ bool shouldPrint(const BinaryFunction &Function) {
166166
}
167167

168168
std::optional<StringRef> Origin = Function.getOriginSectionName();
169-
if (Origin && llvm::any_of(opts::PrintOnly, [&](const std::string &Name) {
170-
return Name == *Origin;
171-
}))
172-
return true;
173-
174-
return false;
169+
return Origin && llvm::is_contained(opts::PrintOnly, *Origin);
175170
}
176171

177172
} // namespace opts

clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ const HeaderMapCollector::RegexHeaderMap *getSTLPostfixHeaderMap() {
606606
{"sys/xattr.h$", "<sys/xattr.h>"},
607607
{"bits/epoll.h$", "<sys/epoll.h>"},
608608
{"bits/eventfd.h$", "<sys/eventfd.h>"},
609+
{"bits/getopt_core.h$", "<getopt.h>"},
610+
{"bits/getopt_ext.h$", "<getopt.h>"},
611+
{"bits/getopt_posix.h$", "<getopt.h>"},
609612
{"bits/inotify.h$", "<sys/inotify.h>"},
610613
{"bits/ipc.h$", "<sys/ipc.h>"},
611614
{"bits/ipctypes.h$", "<sys/ipc.h>"},

clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ IncludeCleanerCheck::IncludeCleanerCheck(StringRef Name,
5959
: ClangTidyCheck(Name, Context),
6060
IgnoreHeaders(
6161
utils::options::parseStringList(Options.get("IgnoreHeaders", ""))),
62-
DeduplicateFindings(Options.get("DeduplicateFindings", true)) {
62+
DeduplicateFindings(Options.get("DeduplicateFindings", true)),
63+
UnusedIncludes(Options.get("UnusedIncludes", true)),
64+
MissingIncludes(Options.get("MissingIncludes", true)) {
6365
for (const auto &Header : IgnoreHeaders) {
6466
if (!llvm::Regex{Header}.isValid())
6567
configurationDiag("Invalid ignore headers regex '%0'") << Header;
@@ -68,12 +70,19 @@ IncludeCleanerCheck::IncludeCleanerCheck(StringRef Name,
6870
HeaderSuffix += "$";
6971
IgnoreHeadersRegex.emplace_back(HeaderSuffix);
7072
}
73+
74+
if (UnusedIncludes == false && MissingIncludes == false)
75+
this->configurationDiag("The check 'misc-include-cleaner' will not "
76+
"perform any analysis because 'UnusedIncludes' and "
77+
"'MissingIncludes' are both false.");
7178
}
7279

7380
void IncludeCleanerCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
7481
Options.store(Opts, "IgnoreHeaders",
7582
utils::options::serializeStringList(IgnoreHeaders));
7683
Options.store(Opts, "DeduplicateFindings", DeduplicateFindings);
84+
Options.store(Opts, "UnusedIncludes", UnusedIncludes);
85+
Options.store(Opts, "MissingIncludes", MissingIncludes);
7786
}
7887

7988
bool IncludeCleanerCheck::isLanguageVersionSupported(
@@ -200,39 +209,43 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult &Result) {
200209
if (!FileStyle)
201210
FileStyle = format::getLLVMStyle();
202211

203-
for (const auto *Inc : Unused) {
204-
diag(Inc->HashLocation, "included header %0 is not used directly")
205-
<< llvm::sys::path::filename(Inc->Spelled,
206-
llvm::sys::path::Style::posix)
207-
<< FixItHint::CreateRemoval(CharSourceRange::getCharRange(
208-
SM->translateLineCol(SM->getMainFileID(), Inc->Line, 1),
209-
SM->translateLineCol(SM->getMainFileID(), Inc->Line + 1, 1)));
212+
if (UnusedIncludes) {
213+
for (const auto *Inc : Unused) {
214+
diag(Inc->HashLocation, "included header %0 is not used directly")
215+
<< llvm::sys::path::filename(Inc->Spelled,
216+
llvm::sys::path::Style::posix)
217+
<< FixItHint::CreateRemoval(CharSourceRange::getCharRange(
218+
SM->translateLineCol(SM->getMainFileID(), Inc->Line, 1),
219+
SM->translateLineCol(SM->getMainFileID(), Inc->Line + 1, 1)));
220+
}
210221
}
211222

212-
tooling::HeaderIncludes HeaderIncludes(getCurrentMainFile(), Code,
213-
FileStyle->IncludeStyle);
214-
// Deduplicate insertions when running in bulk fix mode.
215-
llvm::StringSet<> InsertedHeaders{};
216-
for (const auto &Inc : Missing) {
217-
std::string Spelling = include_cleaner::spellHeader(
218-
{Inc.Missing, PP->getHeaderSearchInfo(), MainFile});
219-
bool Angled = llvm::StringRef{Spelling}.starts_with("<");
220-
// We might suggest insertion of an existing include in edge cases, e.g.,
221-
// include is present in a PP-disabled region, or spelling of the header
222-
// turns out to be the same as one of the unresolved includes in the
223-
// main file.
224-
if (auto Replacement =
225-
HeaderIncludes.insert(llvm::StringRef{Spelling}.trim("\"<>"),
226-
Angled, tooling::IncludeDirective::Include)) {
227-
DiagnosticBuilder DB =
228-
diag(SM->getSpellingLoc(Inc.SymRef.RefLocation),
229-
"no header providing \"%0\" is directly included")
230-
<< Inc.SymRef.Target.name();
231-
if (areDiagsSelfContained() ||
232-
InsertedHeaders.insert(Replacement->getReplacementText()).second) {
233-
DB << FixItHint::CreateInsertion(
234-
SM->getComposedLoc(SM->getMainFileID(), Replacement->getOffset()),
235-
Replacement->getReplacementText());
223+
if (MissingIncludes) {
224+
tooling::HeaderIncludes HeaderIncludes(getCurrentMainFile(), Code,
225+
FileStyle->IncludeStyle);
226+
// Deduplicate insertions when running in bulk fix mode.
227+
llvm::StringSet<> InsertedHeaders{};
228+
for (const auto &Inc : Missing) {
229+
std::string Spelling = include_cleaner::spellHeader(
230+
{Inc.Missing, PP->getHeaderSearchInfo(), MainFile});
231+
bool Angled = llvm::StringRef{Spelling}.starts_with("<");
232+
// We might suggest insertion of an existing include in edge cases, e.g.,
233+
// include is present in a PP-disabled region, or spelling of the header
234+
// turns out to be the same as one of the unresolved includes in the
235+
// main file.
236+
if (auto Replacement = HeaderIncludes.insert(
237+
llvm::StringRef{Spelling}.trim("\"<>"), Angled,
238+
tooling::IncludeDirective::Include)) {
239+
DiagnosticBuilder DB =
240+
diag(SM->getSpellingLoc(Inc.SymRef.RefLocation),
241+
"no header providing \"%0\" is directly included")
242+
<< Inc.SymRef.Target.name();
243+
if (areDiagsSelfContained() ||
244+
InsertedHeaders.insert(Replacement->getReplacementText()).second) {
245+
DB << FixItHint::CreateInsertion(
246+
SM->getComposedLoc(SM->getMainFileID(), Replacement->getOffset()),
247+
Replacement->getReplacementText());
248+
}
236249
}
237250
}
238251
}

clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class IncludeCleanerCheck : public ClangTidyCheck {
4747
std::vector<StringRef> IgnoreHeaders;
4848
// Whether emit only one finding per usage of a symbol.
4949
const bool DeduplicateFindings;
50+
// Whether to report unused includes.
51+
const bool UnusedIncludes;
52+
// Whether to report missing includes.
53+
const bool MissingIncludes;
5054
llvm::SmallVector<llvm::Regex> IgnoreHeadersRegex;
5155
bool shouldIgnore(const include_cleaner::Header &H);
5256
};

clang-tools-extra/clangd/index/CanonicalIncludes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,9 @@ const std::pair<llvm::StringRef, llvm::StringRef> IncludeMappings[] = {
621621
{"sys/xattr.h", "<sys/xattr.h>"},
622622
{"bits/epoll.h", "<sys/epoll.h>"},
623623
{"bits/eventfd.h", "<sys/eventfd.h>"},
624+
{"bits/getopt_core.h", "<getopt.h>"},
625+
{"bits/getopt_ext.h", "<getopt.h>"},
626+
{"bits/getopt_posix.h", "<getopt.h>"},
624627
{"bits/inotify.h", "<sys/inotify.h>"},
625628
{"bits/ipc.h", "<sys/ipc.h>"},
626629
{"bits/ipctypes.h", "<sys/ipc.h>"},

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ Changes in existing checks
184184
`AnalyzePointers` option and fixing false positives when using const array
185185
type.
186186

187+
- Improved :doc:`misc-include-cleaner
188+
<clang-tidy/checks/misc/include-cleaner>` check by adding the options
189+
`UnusedIncludes` and `MissingIncludes`, which specify whether the check should
190+
report unused or missing includes respectively.
191+
187192
- Improved :doc:`misc-redundant-expression
188193
<clang-tidy/checks/misc/redundant-expression>` check by providing additional
189194
examples and fixing some macro related false positives.
@@ -208,7 +213,7 @@ Changes in existing checks
208213
diagnosing designated initializers for ``std::array`` initializations.
209214

210215
- Improved :doc:`modernize-use-ranges
211-
<clang-tidy/checks/modernize/use-ranges>` check by updating suppress
216+
<clang-tidy/checks/modernize/use-ranges>` check by updating suppress
212217
warnings logic for ``nullptr`` in ``std::find``.
213218

214219
- Improved :doc:`modernize-use-starts-ends-with

0 commit comments

Comments
 (0)