Skip to content

Commit 88559cf

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into fork_l0_plugin
2 parents aebdfe0 + f9226d2 commit 88559cf

File tree

2,126 files changed

+70142
-31546
lines changed

Some content is hidden

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

2,126 files changed

+70142
-31546
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
2222
## Sub-projects Documentation
2323

2424
* oneAPI Data Parallel C++ compiler - See
25-
[GetStartedGuide.md](sycl/doc/GetStartedGuide.md)
25+
[DPC++ Documentation](https://intel.github.io/llvm-docs/)
2626

2727
## DPC++ extensions
2828

clang-tools-extra/clang-query/Query.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
4343
"Set whether to bind the root matcher to \"root\".\n"
4444
" set print-matcher (true|false) "
4545
"Set whether to print the current matcher,\n"
46+
" set traversal <kind> "
47+
"Set traversal kind of clang-query session. Available kinds are:\n"
48+
" AsIs "
49+
"Print and match the AST as clang sees it.\n"
50+
" IgnoreImplicitCastsAndParentheses "
51+
"Omit implicit casts and parens in matching and dumping.\n"
52+
" IgnoreUnlessSpelledInSource "
53+
"Omit AST nodes unless spelled in the source. This mode is the "
54+
"default.\n"
4655
" set output <feature> "
4756
"Set whether to output only <feature> content.\n"
4857
" enable output <feature> "
@@ -98,6 +107,8 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
98107
OS << "Not a valid top-level matcher.\n";
99108
return false;
100109
}
110+
111+
AST->getASTContext().getParentMapContext().setTraversalKind(QS.TK);
101112
Finder.matchAST(AST->getASTContext());
102113

103114
if (QS.PrintMatcher) {
@@ -148,6 +159,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
148159
const SourceManager &SM = Ctx.getSourceManager();
149160
ASTDumper Dumper(OS, &Ctx.getCommentCommandTraits(), &SM,
150161
SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy());
162+
Dumper.SetTraversalKind(QS.TK);
151163
Dumper.Visit(BI->second);
152164
OS << "\n";
153165
}

clang-tools-extra/clang-query/Query.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum QueryKind {
2828
QK_Match,
2929
QK_SetBool,
3030
QK_SetOutputKind,
31+
QK_SetTraversalKind,
3132
QK_EnableOutputKind,
3233
QK_DisableOutputKind,
3334
QK_Quit
@@ -119,6 +120,10 @@ template <> struct SetQueryKind<OutputKind> {
119120
static const QueryKind value = QK_SetOutputKind;
120121
};
121122

123+
template <> struct SetQueryKind<ast_type_traits::TraversalKind> {
124+
static const QueryKind value = QK_SetTraversalKind;
125+
};
126+
122127
/// Query for "set VAR VALUE".
123128
template <typename T> struct SetQuery : Query {
124129
SetQuery(T QuerySession::*Var, T Value)

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ template <typename QueryType> QueryRef QueryParser::parseSetOutputKind() {
128128
llvm_unreachable("Invalid output kind");
129129
}
130130

131+
QueryRef QueryParser::parseSetTraversalKind(
132+
ast_type_traits::TraversalKind QuerySession::*Var) {
133+
StringRef ValStr;
134+
unsigned Value =
135+
LexOrCompleteWord<unsigned>(this, ValStr)
136+
.Case("AsIs", ast_type_traits::TK_AsIs)
137+
.Case("IgnoreImplicitCastsAndParentheses",
138+
ast_type_traits::TK_IgnoreImplicitCastsAndParentheses)
139+
.Case("IgnoreUnlessSpelledInSource",
140+
ast_type_traits::TK_IgnoreUnlessSpelledInSource)
141+
.Default(~0u);
142+
if (Value == ~0u) {
143+
return new InvalidQuery("expected traversal kind, got '" + ValStr + "'");
144+
}
145+
return new SetQuery<ast_type_traits::TraversalKind>(
146+
Var, static_cast<ast_type_traits::TraversalKind>(Value));
147+
}
148+
131149
QueryRef QueryParser::endQuery(QueryRef Q) {
132150
StringRef Extra = Line;
133151
StringRef ExtraTrimmed = Extra.drop_while(
@@ -171,7 +189,8 @@ enum ParsedQueryVariable {
171189
PQV_Invalid,
172190
PQV_Output,
173191
PQV_BindRoot,
174-
PQV_PrintMatcher
192+
PQV_PrintMatcher,
193+
PQV_Traversal
175194
};
176195

177196
QueryRef makeInvalidQueryFromDiagnostics(const Diagnostics &Diag) {
@@ -272,6 +291,7 @@ QueryRef QueryParser::doParse() {
272291
.Case("output", PQV_Output)
273292
.Case("bind-root", PQV_BindRoot)
274293
.Case("print-matcher", PQV_PrintMatcher)
294+
.Case("traversal", PQV_Traversal)
275295
.Default(PQV_Invalid);
276296
if (VarStr.empty())
277297
return new InvalidQuery("expected variable name");
@@ -289,6 +309,9 @@ QueryRef QueryParser::doParse() {
289309
case PQV_PrintMatcher:
290310
Q = parseSetBool(&QuerySession::PrintMatcher);
291311
break;
312+
case PQV_Traversal:
313+
Q = parseSetTraversalKind(&QuerySession::TK);
314+
break;
292315
case PQV_Invalid:
293316
llvm_unreachable("Invalid query kind");
294317
}

clang-tools-extra/clang-query/QueryParser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class QueryParser {
4343
template <typename T> struct LexOrCompleteWord;
4444

4545
QueryRef parseSetBool(bool QuerySession::*Var);
46+
QueryRef
47+
parseSetTraversalKind(ast_type_traits::TraversalKind QuerySession::*Var);
4648
template <typename QueryType> QueryRef parseSetOutputKind();
4749
QueryRef completeMatcherExpression();
4850

clang-tools-extra/clang-query/QuerySession.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H
1010
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H
1111

12+
#include "clang/AST/ASTTypeTraits.h"
1213
#include "clang/ASTMatchers/Dynamic/VariantValue.h"
1314
#include "llvm/ADT/ArrayRef.h"
1415
#include "llvm/ADT/StringMap.h"
@@ -25,7 +26,7 @@ class QuerySession {
2526
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2627
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
2728
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
28-
Terminate(false) {}
29+
Terminate(false), TK(ast_type_traits::TK_IgnoreUnlessSpelledInSource) {}
2930

3031
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3132

@@ -36,6 +37,8 @@ class QuerySession {
3637
bool BindRoot;
3738
bool PrintMatcher;
3839
bool Terminate;
40+
41+
ast_type_traits::TraversalKind TK;
3942
llvm::StringMap<ast_matchers::dynamic::VariantValue> NamedValues;
4043
};
4144

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer,
104104
// for those accesses Sema::PerformObjectMemberConversion always inserts an
105105
// UncheckedDerivedToBase ImplicitCastExpr between the this expr and the
106106
// object expression
107-
auto FoundExprs =
108-
match(findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME")),
109-
*Initializer->getInit(), Context);
107+
auto FoundExprs = match(
108+
traverse(
109+
TK_AsIs,
110+
findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME"))),
111+
*Initializer->getInit(), Context);
110112
for (BoundNodes &BN : FoundExprs)
111113
if (auto *MemExpr = BN.getNodeAs<MemberExpr>("ME"))
112114
if (auto *FD = dyn_cast<FieldDecl>(MemExpr->getMemberDecl()))

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ void DurationDivisionCheck::registerMatchers(MatchFinder *finder) {
2020
const auto DurationExpr =
2121
expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))));
2222
finder->addMatcher(
23-
implicitCastExpr(
24-
hasSourceExpression(ignoringParenCasts(
25-
cxxOperatorCallExpr(hasOverloadedOperatorName("/"),
26-
hasArgument(0, DurationExpr),
27-
hasArgument(1, DurationExpr))
28-
.bind("OpCall"))),
29-
hasImplicitDestinationType(qualType(unless(isInteger()))),
30-
unless(hasParent(cxxStaticCastExpr())),
31-
unless(hasParent(cStyleCastExpr())),
32-
unless(isInTemplateInstantiation())),
23+
traverse(ast_type_traits::TK_AsIs,
24+
implicitCastExpr(
25+
hasSourceExpression(ignoringParenCasts(
26+
cxxOperatorCallExpr(hasOverloadedOperatorName("/"),
27+
hasArgument(0, DurationExpr),
28+
hasArgument(1, DurationExpr))
29+
.bind("OpCall"))),
30+
hasImplicitDestinationType(qualType(unless(isInteger()))),
31+
unless(hasParent(cxxStaticCastExpr())),
32+
unless(hasParent(cStyleCastExpr())),
33+
unless(isInTemplateInstantiation()))),
3334
this);
3435
}
3536

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,23 @@ void FasterStrsplitDelimiterCheck::registerMatchers(MatchFinder *Finder) {
7878

7979
// Find uses of absl::StrSplit(..., "x") and absl::StrSplit(...,
8080
// absl::ByAnyChar("x")) to transform them into absl::StrSplit(..., 'x').
81-
Finder->addMatcher(callExpr(callee(functionDecl(hasName("::absl::StrSplit"))),
82-
hasArgument(1, anyOf(ByAnyCharArg, SingleChar)),
83-
unless(isInTemplateInstantiation()))
84-
.bind("StrSplit"),
85-
this);
81+
Finder->addMatcher(
82+
traverse(ast_type_traits::TK_AsIs,
83+
callExpr(callee(functionDecl(hasName("::absl::StrSplit"))),
84+
hasArgument(1, anyOf(ByAnyCharArg, SingleChar)),
85+
unless(isInTemplateInstantiation()))
86+
.bind("StrSplit")),
87+
this);
8688

8789
// Find uses of absl::MaxSplits("x", N) and
8890
// absl::MaxSplits(absl::ByAnyChar("x"), N) to transform them into
8991
// absl::MaxSplits('x', N).
9092
Finder->addMatcher(
91-
callExpr(
92-
callee(functionDecl(hasName("::absl::MaxSplits"))),
93-
hasArgument(0, anyOf(ByAnyCharArg, ignoringParenCasts(SingleChar))),
94-
unless(isInTemplateInstantiation())),
93+
traverse(ast_type_traits::TK_AsIs,
94+
callExpr(callee(functionDecl(hasName("::absl::MaxSplits"))),
95+
hasArgument(0, anyOf(ByAnyCharArg,
96+
ignoringParenCasts(SingleChar))),
97+
unless(isInTemplateInstantiation()))),
9598
this);
9699
}
97100

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ const clang::CallExpr* ProcessArgument(const Expr* Arg,
6464
static const auto* const Strcat = new auto(hasName("::absl::StrCat"));
6565
const auto IsStrcat = cxxBindTemporaryExpr(
6666
has(callExpr(callee(functionDecl(*Strcat))).bind("StrCat")));
67-
if (const auto* SubStrcatCall = selectFirst<const CallExpr>(
67+
if (const auto *SubStrcatCall = selectFirst<const CallExpr>(
6868
"StrCat",
69-
match(stmt(anyOf(
70-
cxxConstructExpr(IsAlphanum, hasArgument(0, IsStrcat)),
71-
IsStrcat)),
69+
match(stmt(traverse(ast_type_traits::TK_AsIs,
70+
anyOf(cxxConstructExpr(IsAlphanum,
71+
hasArgument(0, IsStrcat)),
72+
IsStrcat))),
7273
*Arg->IgnoreParenImpCasts(), *Result.Context))) {
7374
RemoveCallLeaveArgs(SubStrcatCall, CheckResult);
7475
return SubStrcatCall;

0 commit comments

Comments
 (0)