Skip to content

Commit fcd95a9

Browse files
committed
Merge from 'main' to 'sycl-web' (94 commits)
CONFLICT (content): Merge conflict in clang/include/clang/AST/GlobalDecl.h CONFLICT (content): Merge conflict in clang/include/clang/Basic/Attr.td CONFLICT (content): Merge conflict in clang/lib/AST/Decl.cpp CONFLICT (content): Merge conflict in clang/lib/Basic/Targets/SPIR.h CONFLICT (content): Merge conflict in clang/lib/CodeGen/CodeGenFunction.cpp CONFLICT (content): Merge conflict in clang/lib/CodeGen/Targets/NVPTX.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaDecl.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaDeclAttr.cpp CONFLICT (content): Merge conflict in clang/lib/Sema/SemaSYCL.cpp
2 parents 6b2006a + 3b9ebe9 commit fcd95a9

File tree

559 files changed

+41684
-30725
lines changed

Some content is hidden

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

559 files changed

+41684
-30725
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
steps.docs-changed-subprojects.outputs.workflow_any_changed == 'true'
206206
run: |
207207
cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm
208-
TZ=UTC ninja -C flang-build docs-flang-html
208+
TZ=UTC ninja -C flang-build docs-flang-html docs-flang-man
209209
mkdir built-docs/flang
210210
cp -r flang-build/docs/* built-docs/flang/
211211
- name: Upload docs

clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,11 @@ createSymbolIndexManager(StringRef FilePath) {
167167
// Parse input and fill the database with it.
168168
// <symbol>=<header><, header...>
169169
// Multiple symbols can be given, separated by semicolons.
170-
std::map<std::string, std::vector<std::string>> SymbolsMap;
171170
SmallVector<StringRef, 4> SemicolonSplits;
172171
StringRef(Input).split(SemicolonSplits, ";");
173172
std::vector<find_all_symbols::SymbolAndSignals> Symbols;
174173
for (StringRef Pair : SemicolonSplits) {
175174
auto Split = Pair.split('=');
176-
std::vector<std::string> Headers;
177175
SmallVector<StringRef, 4> CommaSplits;
178176
Split.second.split(CommaSplits, ",");
179177
for (size_t I = 0, E = CommaSplits.size(); I != E; ++I)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ namespace clang::tidy::altera {
1616

1717
void SingleWorkItemBarrierCheck::registerMatchers(MatchFinder *Finder) {
1818
// Find any function that calls barrier but does not call an ID function.
19-
// hasAttr(attr::Kind::OpenCLKernel) restricts it to only kernel functions.
19+
// hasAttr(attr::Kind::DeviceKernel) restricts it to only kernel functions.
2020
// FIXME: Have it accept all functions but check for a parameter that gets an
2121
// ID from one of the four ID functions.
2222
Finder->addMatcher(
2323
// Find function declarations...
2424
functionDecl(
25-
// That are OpenCL kernels...
26-
hasAttr(attr::Kind::OpenCLKernel),
25+
// That are device kernels...
26+
hasAttr(attr::Kind::DeviceKernel),
2727
// And call a barrier function (either 1.x or 2.x version)...
2828
forEachDescendant(callExpr(callee(functionDecl(hasAnyName(
2929
"barrier", "work_group_barrier"))))

clang-tools-extra/clang-tidy/openmp/ExceptionEscapeCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
2020
ClangTidyContext *Context)
2121
: ClangTidyCheck(Name, Context),
2222
RawIgnoredExceptions(Options.get("IgnoredExceptions", "")) {
23-
llvm::SmallVector<StringRef, 8> FunctionsThatShouldNotThrowVec,
24-
IgnoredExceptionsVec;
23+
llvm::SmallVector<StringRef, 8> IgnoredExceptionsVec;
2524

2625
llvm::StringSet<> IgnoredExceptions;
2726
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);

clang-tools-extra/clang-tidy/readability/MathMissingParenthesesCheck.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ using namespace clang::ast_matchers;
1616
namespace clang::tidy::readability {
1717

1818
void MathMissingParenthesesCheck::registerMatchers(MatchFinder *Finder) {
19-
Finder->addMatcher(binaryOperator(unless(hasParent(binaryOperator())),
20-
unless(isAssignmentOperator()),
21-
unless(isComparisonOperator()),
22-
unless(hasAnyOperatorName("&&", "||")),
23-
hasDescendant(binaryOperator()))
24-
.bind("binOp"),
25-
this);
19+
Finder->addMatcher(
20+
binaryOperator(
21+
unless(hasParent(binaryOperator(unless(isAssignmentOperator()),
22+
unless(isComparisonOperator())))),
23+
unless(isAssignmentOperator()), unless(isComparisonOperator()),
24+
unless(hasAnyOperatorName("&&", "||")),
25+
hasDescendant(binaryOperator()))
26+
.bind("binOp"),
27+
this);
2628
}
2729

2830
static int getPrecedence(const BinaryOperator *BinOp) {
@@ -88,10 +90,6 @@ static void addParantheses(const BinaryOperator *BinOp,
8890
void MathMissingParenthesesCheck::check(
8991
const MatchFinder::MatchResult &Result) {
9092
const auto *BinOp = Result.Nodes.getNodeAs<BinaryOperator>("binOp");
91-
std::vector<
92-
std::pair<clang::SourceRange, std::pair<const clang::BinaryOperator *,
93-
const clang::BinaryOperator *>>>
94-
Insertions;
9593
const SourceManager &SM = *Result.SourceManager;
9694
const clang::LangOptions &LO = Result.Context->getLangOpts();
9795
addParantheses(BinOp, nullptr, this, SM, LO);

clang-tools-extra/clangd/IncludeCleaner.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ bool mayConsiderUnused(const Inclusion &Inc, ParsedAST &AST,
117117

118118
std::vector<Diag> generateMissingIncludeDiagnostics(
119119
ParsedAST &AST, llvm::ArrayRef<MissingIncludeDiagInfo> MissingIncludes,
120-
llvm::StringRef Code, HeaderFilter IgnoreHeaders, const ThreadsafeFS &TFS) {
120+
llvm::StringRef Code, HeaderFilter IgnoreHeaders,
121+
HeaderFilter AngledHeaders, HeaderFilter QuotedHeaders,
122+
const ThreadsafeFS &TFS) {
121123
std::vector<Diag> Result;
122124
const SourceManager &SM = AST.getSourceManager();
123125
const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID());
@@ -141,7 +143,18 @@ std::vector<Diag> generateMissingIncludeDiagnostics(
141143
AST.getPreprocessor().getHeaderSearchInfo(), MainFile});
142144

143145
llvm::StringRef HeaderRef{Spelling};
146+
144147
bool Angled = HeaderRef.starts_with("<");
148+
if (SymbolWithMissingInclude.Providers.front().kind() ==
149+
include_cleaner::Header::Kind::Physical) {
150+
for (auto &Filter : Angled ? QuotedHeaders : AngledHeaders) {
151+
if (Filter(ResolvedPath)) {
152+
Angled = !Angled;
153+
break;
154+
}
155+
}
156+
}
157+
145158
// We might suggest insertion of an existing include in edge cases, e.g.,
146159
// include is present in a PP-disabled region, or spelling of the header
147160
// turns out to be the same as one of the unresolved includes in the
@@ -151,6 +164,11 @@ std::vector<Diag> generateMissingIncludeDiagnostics(
151164
if (!Replacement.has_value())
152165
continue;
153166

167+
if (Angled != (Spelling.front() == '<')) {
168+
Spelling.front() = Angled ? '<' : '"';
169+
Spelling.back() = Angled ? '>' : '"';
170+
}
171+
154172
Diag &D = Result.emplace_back();
155173
D.Message =
156174
llvm::formatv("No header providing \"{0}\" is directly included",
@@ -481,18 +499,19 @@ bool isPreferredProvider(const Inclusion &Inc,
481499
return false; // no header provides the symbol
482500
}
483501

484-
std::vector<Diag>
485-
issueIncludeCleanerDiagnostics(ParsedAST &AST, llvm::StringRef Code,
486-
const IncludeCleanerFindings &Findings,
487-
const ThreadsafeFS &TFS,
488-
HeaderFilter IgnoreHeaders) {
502+
std::vector<Diag> issueIncludeCleanerDiagnostics(
503+
ParsedAST &AST, llvm::StringRef Code,
504+
const IncludeCleanerFindings &Findings, const ThreadsafeFS &TFS,
505+
HeaderFilter IgnoreHeaders, HeaderFilter AngledHeaders,
506+
HeaderFilter QuotedHeaders) {
489507
trace::Span Tracer("IncludeCleaner::issueIncludeCleanerDiagnostics");
490508
std::vector<Diag> UnusedIncludes = generateUnusedIncludeDiagnostics(
491509
AST.tuPath(), Findings.UnusedIncludes, Code, IgnoreHeaders);
492510
std::optional<Fix> RemoveAllUnused = removeAllUnusedIncludes(UnusedIncludes);
493511

494512
std::vector<Diag> MissingIncludeDiags = generateMissingIncludeDiagnostics(
495-
AST, Findings.MissingIncludes, Code, IgnoreHeaders, TFS);
513+
AST, Findings.MissingIncludes, Code, IgnoreHeaders, AngledHeaders,
514+
QuotedHeaders, TFS);
496515
std::optional<Fix> AddAllMissing = addAllMissingIncludes(MissingIncludeDiags);
497516

498517
std::optional<Fix> FixAll;

clang-tools-extra/clangd/IncludeCleaner.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ IncludeCleanerFindings
5757
computeIncludeCleanerFindings(ParsedAST &AST,
5858
bool AnalyzeAngledIncludes = false);
5959

60-
std::vector<Diag>
61-
issueIncludeCleanerDiagnostics(ParsedAST &AST, llvm::StringRef Code,
62-
const IncludeCleanerFindings &Findings,
63-
const ThreadsafeFS &TFS,
64-
HeaderFilter IgnoreHeader = {});
60+
std::vector<Diag> issueIncludeCleanerDiagnostics(
61+
ParsedAST &AST, llvm::StringRef Code,
62+
const IncludeCleanerFindings &Findings, const ThreadsafeFS &TFS,
63+
HeaderFilter IgnoreHeader = {}, HeaderFilter AngledHeaders = {},
64+
HeaderFilter QuotedHeaders = {});
6565

6666
/// Converts the clangd include representation to include-cleaner
6767
/// include representation.

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,9 @@ std::vector<Diag> getIncludeCleanerDiags(ParsedAST &AST, llvm::StringRef Code,
381381
Findings.MissingIncludes.clear();
382382
if (SuppressUnused)
383383
Findings.UnusedIncludes.clear();
384-
return issueIncludeCleanerDiagnostics(AST, Code, Findings, TFS,
385-
Cfg.Diagnostics.Includes.IgnoreHeader);
384+
return issueIncludeCleanerDiagnostics(
385+
AST, Code, Findings, TFS, Cfg.Diagnostics.Includes.IgnoreHeader,
386+
Cfg.Style.AngledHeaders, Cfg.Style.QuotedHeaders);
386387
}
387388

388389
tidy::ClangTidyCheckFactories

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
913913
if (!ResourceDir.empty())
914914
Opts.ResourceDir = ResourceDir;
915915
Opts.BuildDynamicSymbolIndex = true;
916-
std::vector<std::unique_ptr<SymbolIndex>> IdxStack;
917916
#if CLANGD_ENABLE_REMOTE
918917
if (RemoteIndexAddress.empty() != ProjectRoot.empty()) {
919918
llvm::errs() << "remote-index-address and project-path have to be "

clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,16 @@ TEST(IncludeCleaner, ComputeMissingHeaders) {
220220
TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
221221
Annotations MainFile(R"cpp(
222222
#include "a.h"
223+
#include "angled_wrapper.h"
223224
#include "all.h"
224225
$insert_b[[]]#include "baz.h"
225226
#include "dir/c.h"
226227
$insert_d[[]]$insert_foo[[]]#include "fuzz.h"
227228
#include "header.h"
228-
$insert_foobar[[]]#include <e.h>
229-
$insert_f[[]]$insert_vector[[]]
229+
$insert_foobar[[]]$insert_quoted[[]]$insert_quoted2[[]]#include "quoted_wrapper.h"
230+
$insert_angled[[]]#include <e.h>
231+
$insert_f[[]]#include <quoted2_wrapper.h>
232+
$insert_vector[[]]
230233
231234
#define DEF(X) const Foo *X;
232235
#define BAZ(X) const X x
@@ -237,6 +240,9 @@ TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
237240
238241
void foo() {
239242
$b[[b]]();
243+
$angled[[angled]]();
244+
$quoted[[quoted]]();
245+
$quoted2[[quoted2]]();
240246
241247
ns::$bar[[Bar]] bar;
242248
bar.d();
@@ -263,12 +269,22 @@ TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
263269
TU.AdditionalFiles["a.h"] = guard("#include \"b.h\"");
264270
TU.AdditionalFiles["b.h"] = guard("void b();");
265271

272+
TU.AdditionalFiles["angled_wrapper.h"] = guard("#include <angled.h>");
273+
TU.AdditionalFiles["angled.h"] = guard("void angled();");
274+
TU.ExtraArgs.push_back("-I" + testPath("."));
275+
276+
TU.AdditionalFiles["quoted_wrapper.h"] = guard("#include \"quoted.h\"");
277+
TU.AdditionalFiles["quoted.h"] = guard("void quoted();");
278+
266279
TU.AdditionalFiles["dir/c.h"] = guard("#include \"d.h\"");
267280
TU.AdditionalFiles["dir/d.h"] =
268281
guard("namespace ns { struct Bar { void d(); }; }");
269282

270283
TU.AdditionalFiles["system/e.h"] = guard("#include <f.h>");
271284
TU.AdditionalFiles["system/f.h"] = guard("void f();");
285+
TU.AdditionalFiles["system/quoted2_wrapper.h"] =
286+
guard("#include <system/quoted2.h>");
287+
TU.AdditionalFiles["system/quoted2.h"] = guard("void quoted2();");
272288
TU.ExtraArgs.push_back("-isystem" + testPath("system"));
273289

274290
TU.AdditionalFiles["fuzz.h"] = guard("#include \"buzz.h\"");
@@ -297,7 +313,15 @@ TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
297313
Findings.UnusedIncludes.clear();
298314
std::vector<clangd::Diag> Diags = issueIncludeCleanerDiagnostics(
299315
AST, TU.Code, Findings, MockFS(),
300-
{[](llvm::StringRef Header) { return Header.ends_with("buzz.h"); }});
316+
/*IgnoreHeaders=*/{[](llvm::StringRef Header) {
317+
return Header.ends_with("buzz.h");
318+
}},
319+
/*AngledHeaders=*/{[](llvm::StringRef Header) {
320+
return Header.contains("angled.h");
321+
}},
322+
/*QuotedHeaders=*/{[](llvm::StringRef Header) {
323+
return Header.contains("quoted.h") || Header.contains("quoted2.h");
324+
}});
301325
EXPECT_THAT(
302326
Diags,
303327
UnorderedElementsAre(
@@ -306,6 +330,23 @@ TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
306330
withFix({Fix(MainFile.range("insert_b"), "#include \"b.h\"\n",
307331
"#include \"b.h\""),
308332
FixMessage("add all missing includes")})),
333+
AllOf(Diag(MainFile.range("angled"),
334+
"No header providing \"angled\" is directly included"),
335+
withFix({Fix(MainFile.range("insert_angled"),
336+
"#include <angled.h>\n", "#include <angled.h>"),
337+
FixMessage("add all missing includes")})),
338+
AllOf(
339+
Diag(MainFile.range("quoted"),
340+
"No header providing \"quoted\" is directly included"),
341+
withFix({Fix(MainFile.range("insert_quoted"),
342+
"#include \"quoted.h\"\n", "#include \"quoted.h\""),
343+
FixMessage("add all missing includes")})),
344+
AllOf(Diag(MainFile.range("quoted2"),
345+
"No header providing \"quoted2\" is directly included"),
346+
withFix(
347+
{Fix(MainFile.range("insert_quoted2"),
348+
"#include \"quoted2.h\"\n", "#include \"quoted2.h\""),
349+
FixMessage("add all missing includes")})),
309350
AllOf(Diag(MainFile.range("bar"),
310351
"No header providing \"ns::Bar\" is directly included"),
311352
withFix({Fix(MainFile.range("insert_d"),

0 commit comments

Comments
 (0)