Skip to content

Commit 07e8899

Browse files
committed
Merge branch sycl
# Conflicts: # sycl/test/reduction/reduction_ctor.cpp # sycl/test/reduction/reduction_nd_s1_rw.cpp # sycl/test/reduction/reduction_transparent.cpp
2 parents e6afe60 + 4c57d4d commit 07e8899

File tree

7,331 files changed

+352487
-97268
lines changed

Some content is hidden

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

7,331 files changed

+352487
-97268
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ sycl/source/stream.cpp @againull
4949

5050
# Specialization constant
5151
sycl/include/CL/sycl/detail/sycl_fe_intrins.hpp @kbobrovs
52-
sycl/include/CL/sycl/detail/spec_constant_impl.hpp @kbobrovs
5352
sycl/include/CL/sycl/experimental/spec_constant.hpp @kbobrovs
53+
sycl/source/detail/spec_constant_impl.hpp @kbobrovs
5454

5555
# Program manager
5656
sycl/source/detail/program_manager @kbobrovs

.github/workflows/clang-format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
fetch-depth: 2
1515

1616
- name: Get clang-format first
17-
run: sudo apt-get install -yqq clang-format-9
17+
run: sudo apt-get install -yqq clang-format-10
1818

1919
- name: Run clang-format for the patch
2020
run: |
21-
git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-9 > ./clang-format.patch
21+
git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-10 > ./clang-format.patch
2222
2323
# Add patch with formatting fixes to CI job artifacts
2424
- uses: actions/upload-artifact@v1

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ autoconf/autom4te.cache
5454
# VS2017 and VSCode config files.
5555
.vscode
5656
.vs
57-
# clangd index
58-
.clangd
57+
# clangd index. (".clangd" is a config file now, thus trailing slash)
58+
.clangd/
59+
.cache
5960
# static analyzer regression testing project files
6061
/clang/utils/analyzer/projects/*/CachedSource
6162
/clang/utils/analyzer/projects/*/PatchedSource

clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@ namespace change_namespace {
1919

2020
namespace {
2121

22-
inline std::string
23-
joinNamespaces(const llvm::SmallVectorImpl<StringRef> &Namespaces) {
24-
if (Namespaces.empty())
25-
return "";
26-
std::string Result(Namespaces.front());
27-
for (auto I = Namespaces.begin() + 1, E = Namespaces.end(); I != E; ++I)
28-
Result += ("::" + *I).str();
29-
return Result;
22+
inline std::string joinNamespaces(ArrayRef<StringRef> Namespaces) {
23+
return llvm::join(Namespaces, "::");
3024
}
3125

3226
// Given "a::b::c", returns {"a", "b", "c"}.

clang-tools-extra/clang-move/Move.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -552,20 +552,22 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
552552

553553
// Match static functions/variable definitions which are defined in named
554554
// namespaces.
555-
Optional<ast_matchers::internal::Matcher<NamedDecl>> HasAnySymbolNames;
555+
SmallVector<std::string, 4> QualNames;
556+
QualNames.reserve(Context->Spec.Names.size());
556557
for (StringRef SymbolName : Context->Spec.Names) {
557-
llvm::StringRef GlobalSymbolName = SymbolName.trim().ltrim(':');
558-
const auto HasName = hasName(("::" + GlobalSymbolName).str());
559-
HasAnySymbolNames =
560-
HasAnySymbolNames ? anyOf(*HasAnySymbolNames, HasName) : HasName;
558+
QualNames.push_back(("::" + SymbolName.trim().ltrim(':')).str());
561559
}
562560

563-
if (!HasAnySymbolNames) {
561+
if (QualNames.empty()) {
564562
llvm::errs() << "No symbols being moved.\n";
565563
return;
566564
}
565+
566+
ast_matchers::internal::Matcher<NamedDecl> HasAnySymbolNames =
567+
hasAnyName(SmallVector<StringRef, 4>(QualNames.begin(), QualNames.end()));
568+
567569
auto InMovedClass =
568-
hasOutermostEnclosingClass(cxxRecordDecl(*HasAnySymbolNames));
570+
hasOutermostEnclosingClass(cxxRecordDecl(HasAnySymbolNames));
569571

570572
// Matchers for helper declarations in old.cc.
571573
auto InAnonymousNS = hasParent(namespaceDecl(isAnonymous()));
@@ -612,38 +614,38 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
612614
// Create a MatchCallback for class declarations.
613615
MatchCallbacks.push_back(std::make_unique<ClassDeclarationMatch>(this));
614616
// Match moved class declarations.
615-
auto MovedClass = cxxRecordDecl(InOldFiles, *HasAnySymbolNames,
616-
isDefinition(), TopLevelDecl)
617-
.bind("moved_class");
617+
auto MovedClass =
618+
cxxRecordDecl(InOldFiles, HasAnySymbolNames, isDefinition(), TopLevelDecl)
619+
.bind("moved_class");
618620
Finder->addMatcher(MovedClass, MatchCallbacks.back().get());
619621
// Match moved class methods (static methods included) which are defined
620622
// outside moved class declaration.
621-
Finder->addMatcher(
622-
cxxMethodDecl(InOldFiles, ofOutermostEnclosingClass(*HasAnySymbolNames),
623-
isDefinition())
624-
.bind("class_method"),
625-
MatchCallbacks.back().get());
623+
Finder->addMatcher(cxxMethodDecl(InOldFiles,
624+
ofOutermostEnclosingClass(HasAnySymbolNames),
625+
isDefinition())
626+
.bind("class_method"),
627+
MatchCallbacks.back().get());
626628
// Match static member variable definition of the moved class.
627629
Finder->addMatcher(
628630
varDecl(InMovedClass, InOldFiles, isDefinition(), isStaticDataMember())
629631
.bind("class_static_var_decl"),
630632
MatchCallbacks.back().get());
631633

632634
MatchCallbacks.push_back(std::make_unique<FunctionDeclarationMatch>(this));
633-
Finder->addMatcher(functionDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl)
635+
Finder->addMatcher(functionDecl(InOldFiles, HasAnySymbolNames, TopLevelDecl)
634636
.bind("function"),
635637
MatchCallbacks.back().get());
636638

637639
MatchCallbacks.push_back(std::make_unique<VarDeclarationMatch>(this));
638640
Finder->addMatcher(
639-
varDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl).bind("var"),
641+
varDecl(InOldFiles, HasAnySymbolNames, TopLevelDecl).bind("var"),
640642
MatchCallbacks.back().get());
641643

642644
// Match enum definition in old.h. Enum helpers (which are defined in old.cc)
643645
// will not be moved for now no matter whether they are used or not.
644646
MatchCallbacks.push_back(std::make_unique<EnumDeclarationMatch>(this));
645647
Finder->addMatcher(
646-
enumDecl(InOldHeader, *HasAnySymbolNames, isDefinition(), TopLevelDecl)
648+
enumDecl(InOldHeader, HasAnySymbolNames, isDefinition(), TopLevelDecl)
647649
.bind("enum"),
648650
MatchCallbacks.back().get());
649651

@@ -653,7 +655,7 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
653655
MatchCallbacks.push_back(std::make_unique<TypeAliasMatch>(this));
654656
Finder->addMatcher(namedDecl(anyOf(typedefDecl().bind("typedef"),
655657
typeAliasDecl().bind("type_alias")),
656-
InOldHeader, *HasAnySymbolNames, TopLevelDecl),
658+
InOldHeader, HasAnySymbolNames, TopLevelDecl),
657659
MatchCallbacks.back().get());
658660
}
659661

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
4646
" set traversal <kind> "
4747
"Set traversal kind of clang-query session. Available kinds are:\n"
4848
" AsIs "
49-
"Print and match the AST as clang sees it.\n"
49+
"Print and match the AST as clang sees it. This mode is the "
50+
"default.\n"
5051
" IgnoreImplicitCastsAndParentheses "
5152
"Omit implicit casts and parens in matching and dumping.\n"
5253
" IgnoreUnlessSpelledInSource "
53-
"Omit AST nodes unless spelled in the source. This mode is the "
54-
"default.\n"
54+
"Omit AST nodes unless spelled in the source.\n"
5555
" set output <feature> "
5656
"Set whether to output only <feature> content.\n"
5757
" enable output <feature> "
@@ -157,8 +157,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
157157
OS << "Binding for \"" << BI->first << "\":\n";
158158
const ASTContext &Ctx = AST->getASTContext();
159159
const SourceManager &SM = Ctx.getSourceManager();
160-
ASTDumper Dumper(OS, &Ctx.getCommentCommandTraits(), &SM,
161-
SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy());
160+
ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
162161
Dumper.SetTraversalKind(QS.TK);
163162
Dumper.Visit(BI->second);
164163
OS << "\n";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QuerySession {
2626
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2727
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
2828
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
29-
Terminate(false), TK(ast_type_traits::TK_IgnoreUnlessSpelledInSource) {}
29+
Terminate(false), TK(ast_type_traits::TK_AsIs) {}
3030

3131
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3232

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

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,25 @@ ClangTidyCheck::OptionsView::get(StringRef LocalName) const {
7676
return llvm::make_error<MissingOptionError>((NamePrefix + LocalName).str());
7777
}
7878

79+
static ClangTidyOptions::OptionMap::const_iterator
80+
findPriorityOption(const ClangTidyOptions::OptionMap &Options, StringRef NamePrefix,
81+
StringRef LocalName) {
82+
auto IterLocal = Options.find((NamePrefix + LocalName).str());
83+
auto IterGlobal = Options.find(LocalName.str());
84+
if (IterLocal == Options.end())
85+
return IterGlobal;
86+
if (IterGlobal == Options.end())
87+
return IterLocal;
88+
if (IterLocal->second.Priority >= IterGlobal->second.Priority)
89+
return IterLocal;
90+
return IterGlobal;
91+
}
92+
7993
llvm::Expected<std::string>
8094
ClangTidyCheck::OptionsView::getLocalOrGlobal(StringRef LocalName) const {
81-
auto IterLocal = CheckOptions.find(NamePrefix + LocalName.str());
82-
auto IterGlobal = CheckOptions.find(LocalName.str());
83-
if (IterLocal != CheckOptions.end() &&
84-
(IterGlobal == CheckOptions.end() ||
85-
IterLocal->second.Priority >= IterGlobal->second.Priority))
86-
return IterLocal->second.Value;
87-
if (IterGlobal != CheckOptions.end())
88-
return IterGlobal->second.Value;
95+
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName);
96+
if (Iter != CheckOptions.end())
97+
return Iter->second.Value;
8998
return llvm::make_error<MissingOptionError>((NamePrefix + LocalName).str());
9099
}
91100

@@ -124,14 +133,9 @@ bool ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName,
124133
template <>
125134
llvm::Expected<bool>
126135
ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName) const {
127-
auto IterLocal = CheckOptions.find(NamePrefix + LocalName.str());
128-
auto IterGlobal = CheckOptions.find(LocalName.str());
129-
if (IterLocal != CheckOptions.end() &&
130-
(IterGlobal == CheckOptions.end() ||
131-
IterLocal->second.Priority >= IterGlobal->second.Priority))
132-
return getAsBool(IterLocal->second.Value, NamePrefix + LocalName);
133-
if (IterGlobal != CheckOptions.end())
134-
return getAsBool(IterGlobal->second.Value, llvm::Twine(LocalName));
136+
auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName);
137+
if (Iter != CheckOptions.end())
138+
return getAsBool(Iter->second.Value, Iter->first);
135139
return llvm::make_error<MissingOptionError>((NamePrefix + LocalName).str());
136140
}
137141

@@ -151,18 +155,26 @@ void ClangTidyCheck::OptionsView::store(ClangTidyOptions::OptionMap &Options,
151155
Options[NamePrefix + LocalName.str()] = Value;
152156
}
153157

154-
void ClangTidyCheck::OptionsView::store(ClangTidyOptions::OptionMap &Options,
155-
StringRef LocalName,
156-
int64_t Value) const {
158+
void ClangTidyCheck::OptionsView::storeInt(ClangTidyOptions::OptionMap &Options,
159+
StringRef LocalName,
160+
int64_t Value) const {
157161
store(Options, LocalName, llvm::itostr(Value));
158162
}
159163

160-
llvm::Expected<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
161-
StringRef LocalName, ArrayRef<std::pair<StringRef, int64_t>> Mapping,
162-
bool CheckGlobal, bool IgnoreCase) {
163-
auto Iter = CheckOptions.find((NamePrefix + LocalName).str());
164-
if (CheckGlobal && Iter == CheckOptions.end())
165-
Iter = CheckOptions.find(LocalName.str());
164+
template <>
165+
void ClangTidyCheck::OptionsView::store<bool>(
166+
ClangTidyOptions::OptionMap &Options, StringRef LocalName,
167+
bool Value) const {
168+
store(Options, LocalName, Value ? StringRef("true") : StringRef("false"));
169+
}
170+
171+
llvm::Expected<int64_t>
172+
ClangTidyCheck::OptionsView::getEnumInt(StringRef LocalName,
173+
ArrayRef<NameAndValue> Mapping,
174+
bool CheckGlobal, bool IgnoreCase) {
175+
auto Iter = CheckGlobal
176+
? findPriorityOption(CheckOptions, NamePrefix, LocalName)
177+
: CheckOptions.find((NamePrefix + LocalName).str());
166178
if (Iter == CheckOptions.end())
167179
return llvm::make_error<MissingOptionError>((NamePrefix + LocalName).str());
168180

@@ -171,19 +183,19 @@ llvm::Expected<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
171183
unsigned EditDistance = -1;
172184
for (const auto &NameAndEnum : Mapping) {
173185
if (IgnoreCase) {
174-
if (Value.equals_lower(NameAndEnum.first))
175-
return NameAndEnum.second;
176-
} else if (Value.equals(NameAndEnum.first)) {
177-
return NameAndEnum.second;
178-
} else if (Value.equals_lower(NameAndEnum.first)) {
179-
Closest = NameAndEnum.first;
186+
if (Value.equals_lower(NameAndEnum.second))
187+
return NameAndEnum.first;
188+
} else if (Value.equals(NameAndEnum.second)) {
189+
return NameAndEnum.first;
190+
} else if (Value.equals_lower(NameAndEnum.second)) {
191+
Closest = NameAndEnum.second;
180192
EditDistance = 0;
181193
continue;
182194
}
183-
unsigned Distance = Value.edit_distance(NameAndEnum.first);
195+
unsigned Distance = Value.edit_distance(NameAndEnum.second);
184196
if (Distance < EditDistance) {
185197
EditDistance = Distance;
186-
Closest = NameAndEnum.first;
198+
Closest = NameAndEnum.second;
187199
}
188200
}
189201
if (EditDistance < 3)

0 commit comments

Comments
 (0)