Skip to content

Commit 74aa84b

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 05e672b + 5b286f3 commit 74aa84b

File tree

562 files changed

+12256
-4368
lines changed

Some content is hidden

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

562 files changed

+12256
-4368
lines changed

buildbot/compile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ def do_compile(args):
1313
except NotImplementedError:
1414
cpu_count = DEFAULT_CPU_COUNT
1515

16+
if args.build_parallelism:
17+
cpu_count = int(args.build_parallelism)
18+
1619
# Get absolute path to source directory
1720
if args.src_dir:
1821
abs_src_dir = os.path.abspath(args.src_dir)
@@ -51,6 +54,7 @@ def main():
5154
help="builder directory, which is the directory contains source and build directories")
5255
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", help="source directory")
5356
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", help="build directory")
57+
parser.add_argument("-j", "--build-parallelism", metavar="BUILD_PARALLELISM", help="build parallelism")
5458

5559
args = parser.parse_args()
5660

buildbot/dependency.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ocl_gpu_rt_ver=20.29.17408
1010
# https://downloadmirror.intel.com/29674/a08/igfx_win10_100.8336.zip
1111
ocl_gpu_rt_ver_win=27.20.100.8336
1212
intel_sycl_ver=build
13-
# TODO provide URL for Linux TBB driver
13+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-lin.tgz
1414
tbb_ver=2021.1.8.515
15-
# TODO provide URL for Windows TBB driver
15+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-win.zip
1616
tbb_ver_win=2021.1.8.514
1717
# https://github.com/intel/llvm/releases/download/2020-WW31/fpgaemu-2020.10.7.0.15_rel.tar.gz
1818
ocl_fpga_emu_ver=2020.10.7.0.15

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ CreateSymbolInfo(const NamedDecl *ND, const SourceManager &SM,
9999

100100
SourceLocation Loc = SM.getExpansionLoc(ND->getLocation());
101101
if (!Loc.isValid()) {
102-
llvm::errs() << "Declaration " << ND->getNameAsString() << "("
102+
llvm::errs() << "Declaration " << ND->getDeclName() << "("
103103
<< ND->getDeclKindName()
104104
<< ") has invalid declaration location.";
105105
return llvm::None;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void HelperDeclRGBuilder::run(
116116
const auto *DC = Result.Nodes.getNodeAs<Decl>("dc");
117117
assert(DC);
118118
LLVM_DEBUG(llvm::dbgs() << "Find helper function usage: "
119-
<< FuncRef->getDecl()->getNameAsString() << " ("
119+
<< FuncRef->getDecl()->getDeclName() << " ("
120120
<< FuncRef->getDecl() << ")\n");
121121
RG->addEdge(
122122
getOutmostClassOrFunDecl(DC->getCanonicalDecl()),
@@ -126,7 +126,7 @@ void HelperDeclRGBuilder::run(
126126
const auto *DC = Result.Nodes.getNodeAs<Decl>("dc");
127127
assert(DC);
128128
LLVM_DEBUG(llvm::dbgs()
129-
<< "Find helper class usage: " << UsedClass->getNameAsString()
129+
<< "Find helper class usage: " << UsedClass->getDeclName()
130130
<< " (" << UsedClass << ")\n");
131131
RG->addEdge(getOutmostClassOrFunDecl(DC->getCanonicalDecl()), UsedClass);
132132
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ void ClangMoveTool::run(const ast_matchers::MatchFinder::MatchResult &Result) {
675675
Result.Nodes.getNodeAs<NamedDecl>("helper_decls")) {
676676
MovedDecls.push_back(ND);
677677
HelperDeclarations.push_back(ND);
678-
LLVM_DEBUG(llvm::dbgs() << "Add helper : " << ND->getNameAsString() << " ("
679-
<< ND << ")\n");
678+
LLVM_DEBUG(llvm::dbgs()
679+
<< "Add helper : " << ND->getDeclName() << " (" << ND << ")\n");
680680
} else if (const auto *UD = Result.Nodes.getNodeAs<NamedDecl>("using_decl")) {
681681
MovedDecls.push_back(UD);
682682
}
@@ -735,12 +735,12 @@ void ClangMoveTool::removeDeclsInOldFiles() {
735735
// We remove the helper declarations which are not used in the old.cc after
736736
// moving the given declarations.
737737
for (const auto *D : HelperDeclarations) {
738-
LLVM_DEBUG(llvm::dbgs() << "Check helper is used: "
739-
<< D->getNameAsString() << " (" << D << ")\n");
738+
LLVM_DEBUG(llvm::dbgs() << "Check helper is used: " << D->getDeclName()
739+
<< " (" << D << ")\n");
740740
if (!UsedDecls.count(HelperDeclRGBuilder::getOutmostClassOrFunDecl(
741741
D->getCanonicalDecl()))) {
742742
LLVM_DEBUG(llvm::dbgs() << "Helper removed in old.cc: "
743-
<< D->getNameAsString() << " (" << D << ")\n");
743+
<< D->getDeclName() << " (" << D << ")\n");
744744
RemovedDecls.push_back(D);
745745
}
746746
}
@@ -820,7 +820,7 @@ void ClangMoveTool::moveDeclsToNewFiles() {
820820
D->getCanonicalDecl())))
821821
continue;
822822

823-
LLVM_DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getNameAsString()
823+
LLVM_DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getDeclName()
824824
<< " " << D << "\n");
825825
ActualNewCCDecls.push_back(D);
826826
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ static Preprocessor *PP;
3030

3131
void BadSignalToKillThreadCheck::check(const MatchFinder::MatchResult &Result) {
3232
const auto IsSigterm = [](const auto &KeyValue) -> bool {
33-
return KeyValue.first->getName() == "SIGTERM";
33+
return KeyValue.first->getName() == "SIGTERM" &&
34+
KeyValue.first->hasMacroDefinition();
3435
};
3536
const auto TryExpandAsInteger =
3637
[](Preprocessor::macro_iterator It) -> Optional<unsigned> {
3738
if (It == PP->macro_end())
3839
return llvm::None;
3940
const MacroInfo *MI = PP->getMacroInfo(It->first);
4041
const Token &T = MI->tokens().back();
42+
if (!T.isLiteral())
43+
return llvm::None;
4144
StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
4245

4346
llvm::APInt IntValue;

clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ renameParameters(const FunctionDecl *Dest, const FunctionDecl *Source) {
339339
// specialization.
340340
const FunctionDecl *findTarget(const FunctionDecl *FD) {
341341
auto CanonDecl = FD->getCanonicalDecl();
342-
if (!FD->isFunctionTemplateSpecialization())
342+
if (!FD->isFunctionTemplateSpecialization() || CanonDecl == FD)
343343
return CanonDecl;
344344
// For specializations CanonicalDecl is the TemplatedDecl, which is not the
345345
// target we want to inline into. Instead we traverse previous decls to find

clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@ getFunctionSourceAfterReplacements(const FunctionDecl *FD,
122122
if (!OrigFuncRange)
123123
return llvm::createStringError(llvm::inconvertibleErrorCode(),
124124
"Couldn't get range for function.");
125-
// Include template parameter list.
126-
if (auto *FTD = FD->getDescribedFunctionTemplate())
127-
OrigFuncRange->setBegin(FTD->getBeginLoc());
125+
assert(!FD->getDescribedFunctionTemplate() &&
126+
"Define out-of-line doesn't apply to function templates.");
128127

129128
// Get new begin and end positions for the qualified function definition.
130129
unsigned FuncBegin = SM.getFileOffset(OrigFuncRange->getBegin());
@@ -387,6 +386,13 @@ class DefineOutline : public Tweak {
387386
Source->isOutOfLine())
388387
return false;
389388

389+
// Bail out if this is a function template or specialization, as their
390+
// definitions need to be visible in all including translation units.
391+
if (auto *PT = Source->getDescribedFunctionTemplate())
392+
return false;
393+
if (auto *TSI = Source->getTemplateSpecializationInfo())
394+
return false;
395+
390396
// Bail out in templated classes, as it is hard to spell the class name, i.e
391397
// if the template parameter is unnamed.
392398
if (auto *MD = llvm::dyn_cast<CXXMethodDecl>(Source)) {

clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,6 @@ CapturedZoneInfo captureZoneInfo(const ExtractionZone &ExtZone) {
480480
CurNumberOfSwitch += Increment;
481481
}
482482

483-
// Decrement CurNumberOf{NestedLoops,Switch} if statement is {Loop,Switch}
484-
// and inside Extraction Zone.
485-
void decrementLoopSwitchCounters(Stmt *S) {
486-
if (CurrentLocation != ZoneRelative::Inside)
487-
return;
488-
if (isLoop(S))
489-
CurNumberOfNestedLoops--;
490-
else if (isa<SwitchStmt>(S))
491-
CurNumberOfSwitch--;
492-
}
493-
494483
bool VisitDecl(Decl *D) {
495484
Info.createDeclInfo(D, CurrentLocation);
496485
return true;

clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class SwapIfBranches : public Tweak {
4040
Expected<Effect> apply(const Selection &Inputs) override;
4141
std::string title() const override { return "Swap if branches"; }
4242
Intent intent() const override { return Refactor; }
43+
bool hidden() const override { return true; }
4344

4445
private:
4546
const IfStmt *If = nullptr;

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

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,11 @@ TEST_F(DefineInlineTest, TemplateSpec) {
10931093
template<> void f^oo<int>() {
10941094
bar();
10951095
})cpp");
1096+
EXPECT_UNAVAILABLE(R"cpp(
1097+
namespace bar {
1098+
template <typename T> void f^oo() {}
1099+
template void foo<int>();
1100+
})cpp");
10961101
}
10971102

10981103
TEST_F(DefineInlineTest, CheckForCanonDecl) {
@@ -2003,6 +2008,13 @@ TEST_F(DefineOutlineTest, TriggersOnFunctionDecl) {
20032008
EXPECT_UNAVAILABLE(R"cpp(
20042009
template <typename> struct Foo { void fo^o(){} };
20052010
)cpp");
2011+
2012+
// Not available on function templates and specializations, as definition must
2013+
// be visible to all translation units.
2014+
EXPECT_UNAVAILABLE(R"cpp(
2015+
template <typename> void fo^o() {};
2016+
template <> void fo^o<int>() {};
2017+
)cpp");
20062018
}
20072019

20082020
TEST_F(DefineOutlineTest, FailsWithoutSource) {
@@ -2032,27 +2044,6 @@ TEST_F(DefineOutlineTest, ApplyTest) {
20322044
"void foo() ;",
20332045
"void foo() { return; }",
20342046
},
2035-
// Templated function.
2036-
{
2037-
"template <typename T> void fo^o(T, T x) { return; }",
2038-
"template <typename T> void foo(T, T x) ;",
2039-
"template <typename T> void foo(T, T x) { return; }",
2040-
},
2041-
{
2042-
"template <typename> void fo^o() { return; }",
2043-
"template <typename> void foo() ;",
2044-
"template <typename> void foo() { return; }",
2045-
},
2046-
// Template specialization.
2047-
{
2048-
R"cpp(
2049-
template <typename> void foo();
2050-
template <> void fo^o<int>() { return; })cpp",
2051-
R"cpp(
2052-
template <typename> void foo();
2053-
template <> void foo<int>() ;)cpp",
2054-
"template <> void foo<int>() { return; }",
2055-
},
20562047
// Default args.
20572048
{
20582049
"void fo^o(int x, int y = 5, int = 2, int (*foo)(int) = nullptr) {}",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: clang-tidy %s --checks=-*,bugprone-bad-signal-to-kill-thread -- | count 0
2+
3+
#define SIGTERM ((unsigned)15) // no-crash
4+
using pthread_t = int;
5+
int pthread_kill(pthread_t thread, int sig);
6+
7+
int func() {
8+
pthread_t thread;
9+
return pthread_kill(thread, 0);
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: clang-tidy %s --checks=-*,bugprone-bad-signal-to-kill-thread -- | count 0
2+
3+
#define SIGTERM 15
4+
#undef SIGTERM // no-crash
5+
using pthread_t = int;
6+
int pthread_kill(pthread_t thread, int sig);
7+
8+
int func() {
9+
pthread_t thread;
10+
return pthread_kill(thread, 0);
11+
}

clang/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,15 @@ if (APPLE)
424424
RESULT_VARIABLE HAD_ERROR
425425
OUTPUT_VARIABLE LD_V_OUTPUT
426426
)
427-
if (NOT HAD_ERROR)
428-
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
429-
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
430-
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
431-
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
432-
endif()
433-
else()
427+
if (HAD_ERROR)
434428
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
435429
endif()
430+
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
431+
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
432+
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
433+
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
434+
endif()
435+
message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
436436
endif()
437437

438438
include(CMakeParseArguments)

clang/docs/OpenMPSupport.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ implementation.
221221
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
222222
| device extension | pointer attachment | :none:`unclaimed` | |
223223
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
224+
| device extension | map clause reordering based on map types | :none:`unclaimed` | |
225+
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
224226
| atomic extension | hints for the atomic construct | :good:`done` | D51233 |
225227
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
226228
| base language | C11 support | :good:`done` | |
@@ -268,7 +270,9 @@ want to help with the implementation.
268270
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
269271
| loop extension | Loop tiling transformation | :part:`worked on` | D76342 |
270272
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
271-
| device extension | 'present' map type modifier | :part:`mostly done` | D83061, D83062, D84422 |
273+
| device extension | 'present' map type modifier | :good:`done` | D83061, D83062, D84422 |
272274
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
273275
| device extension | 'present' motion modifier | :good:`done` | D84711, D84712 |
274276
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
277+
| device extension | map clause reordering reordering based on 'present' modifier | :none:`unclaimed` | |
278+
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+

clang/docs/analyzer/checkers.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,25 @@ Raw pointers and references to uncounted types can't be used as class members. O
14231423
// ...
14241424
};
14251425
1426+
.. _webkit-UncountedLambdaCapturesChecker:
1427+
1428+
webkit.UncountedLambdaCapturesChecker
1429+
"""""""""""""""""""""""""""""""""""""
1430+
Raw pointers and references to uncounted types can't be captured in lambdas. Only ref-counted types are allowed.
1431+
1432+
.. code-block:: cpp
1433+
1434+
struct RefCntbl {
1435+
void ref() {}
1436+
void deref() {}
1437+
};
1438+
1439+
void foo(RefCntbl* a, RefCntbl& b) {
1440+
[&, a](){ // warn about 'a'
1441+
do_something(b); // warn about 'b'
1442+
};
1443+
};
1444+
14261445
.. _alpha-checkers:
14271446
14281447
Experimental Checkers

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ class NamedDecl : public Decl {
265265
// FIXME: Deprecated, move clients to getName().
266266
std::string getNameAsString() const { return Name.getAsString(); }
267267

268+
/// Pretty-print the unqualified name of this declaration. Can be overloaded
269+
/// by derived classes to provide a more user-friendly name when appropriate.
268270
virtual void printName(raw_ostream &os) const;
269271

270272
/// Get the actual, stored name of the declaration, which may be a special

clang/include/clang/AST/DeclTemplate.h

100755100644
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ class TemplateParameterList final
204204
bool OmitTemplateKW = false) const;
205205
void print(raw_ostream &Out, const ASTContext &Context,
206206
const PrintingPolicy &Policy, bool OmitTemplateKW = false) const;
207-
208-
public:
209-
// FIXME: workaround for MSVC 2013; remove when no longer needed
210-
using FixedSizeStorageOwner = TrailingObjects::FixedSizeStorageOwner;
211207
};
212208

213209
/// Stores a list of template parameters and the associated

0 commit comments

Comments
 (0)