Skip to content

Commit b0326ba

Browse files
committed
Fixing merge conflict (fourth attempt)
2 parents fe2d230 + 02756e3 commit b0326ba

File tree

2,804 files changed

+134346
-53243
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,804 files changed

+134346
-53243
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ clang/tools/clang-offload-deps/ @sndmitriev @mlychkov @AlexeySachkov
9999
clang/tools/clang-offload-extract/ @sndmitriev @mlychkov @AlexeySachkov
100100

101101
# Explicit SIMD
102-
SYCLLowerIR/ @kbobrovs @DenisBakhvalov
103-
esimd/ @kbobrovs @DenisBakhvalov
104-
sycl/include/sycl/ext/intel/experimental/esimd.hpp @kbobrovs @DenisBakhvalov
105-
sycl/doc/extensions/ExplicitSIMD/ @kbobrovs
102+
SYCLLowerIR/ @kbobrovs @DenisBakhvalov @kychendev
103+
esimd/ @kbobrovs @DenisBakhvalov @kychendev
104+
sycl/include/sycl/ext/intel/experimental/esimd.hpp @kbobrovs @DenisBakhvalov @kychendev
105+
sycl/doc/extensions/ExplicitSIMD/ @kbobrovs @DenisBakhvalov @kychendev
106106

107107
# ITT annotations
108108
llvm/lib/Transforms/Instrumentation/SPIRITTAnnotations.cpp @MrSidims @vzakhari

.github/workflows/gh_pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install deps
1717
run: |
1818
sudo apt-get install -y doxygen graphviz ssh ninja-build
19-
sudo pip3 install 'sphinx==3.0.0' 'recommonmark==0.6.0' 'sphinx_markdown_tables==0.0.12'
19+
sudo pip3 install 'sphinx==4.1.2' 'myst-parser==0.15.1'
2020
- name: Build Docs
2121
run: |
2222
mkdir -p $GITHUB_WORKSPACE/build

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
Jon Roelofs <[email protected]> Jon Roelofs <[email protected]>
3232
Jon Roelofs <[email protected]> Jonathan Roelofs <[email protected]>
3333
Jon Roelofs <[email protected]> Jonathan Roelofs <[email protected]>
34+
LLVM GN Syncbot <[email protected]>
3435
Martin Storsjö <[email protected]>
3536
Saleem Abdulrasool <[email protected]> <[email protected]>

buildbot/configure.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def do_configure(args):
2727
llvm_targets_to_build = 'X86'
2828
llvm_enable_projects = 'clang;' + llvm_external_projects
2929
libclc_targets_to_build = ''
30+
libclc_gen_remangled_variants = 'OFF'
3031
sycl_build_pi_cuda = 'OFF'
3132
sycl_build_pi_esimd_cpu = 'ON'
3233
sycl_build_pi_rocm = 'OFF'
@@ -53,6 +54,7 @@ def do_configure(args):
5354
if args.cuda:
5455
llvm_targets_to_build += ';NVPTX'
5556
libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
57+
libclc_gen_remangled_variants = 'ON'
5658
sycl_build_pi_cuda = 'ON'
5759

5860
if args.rocm:
@@ -62,6 +64,7 @@ def do_configure(args):
6264
elif args.rocm_platform == 'NVIDIA' and not args.cuda:
6365
llvm_targets_to_build += ';NVPTX'
6466
libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl'
67+
libclc_gen_remangled_variants = 'ON'
6568

6669
sycl_build_pi_rocm_platform = args.rocm_platform
6770
sycl_build_pi_rocm = 'ON'
@@ -99,6 +102,7 @@ def do_configure(args):
99102
"-DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR={}".format(libdevice_dir),
100103
"-DLLVM_ENABLE_PROJECTS={}".format(llvm_enable_projects),
101104
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
105+
"-DLIBCLC_GENERATE_REMANGLED_VARIANTS={}".format(libclc_gen_remangled_variants),
102106
"-DSYCL_BUILD_PI_CUDA={}".format(sycl_build_pi_cuda),
103107
"-DSYCL_BUILD_PI_ROCM={}".format(sycl_build_pi_rocm),
104108
"-DSYCL_BUILD_PI_ROCM_PLATFORM={}".format(sycl_build_pi_rocm_platform),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
442442
hasDeclaration(DeclMatcher),
443443
unless(templateSpecializationType()))))),
444444
hasParent(nestedNameSpecifierLoc()),
445-
hasAncestor(isImplicit()),
445+
hasAncestor(decl(isImplicit())),
446446
hasAncestor(UsingShadowDeclInClass),
447447
hasAncestor(functionDecl(isDefaulted())))),
448448
hasAncestor(decl().bind("dc")))
@@ -466,7 +466,7 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
466466
hasAncestor(decl(IsInMovedNs).bind("dc")),
467467
loc(nestedNameSpecifier(
468468
specifiesType(hasDeclaration(DeclMatcher.bind("from_decl"))))),
469-
unless(anyOf(hasAncestor(isImplicit()),
469+
unless(anyOf(hasAncestor(decl(isImplicit())),
470470
hasAncestor(UsingShadowDeclInClass),
471471
hasAncestor(functionDecl(isDefaulted())),
472472
hasAncestor(typeLoc(loc(qualType(hasDeclaration(
@@ -495,7 +495,7 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
495495
hasAncestor(cxxRecordDecl()))),
496496
hasParent(namespaceDecl()));
497497
Finder->addMatcher(expr(hasAncestor(decl().bind("dc")), IsInMovedNs,
498-
unless(hasAncestor(isImplicit())),
498+
unless(hasAncestor(decl(isImplicit()))),
499499
anyOf(callExpr(callee(FuncMatcher)).bind("call"),
500500
declRefExpr(to(FuncMatcher.bind("func_decl")))
501501
.bind("func_ref"))),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ makeRewriteRule(const std::vector<std::string> &StringLikeClassNames,
5353
to(varDecl(hasName("npos"), hasDeclContext(StringLikeClass))));
5454
auto StringFind = cxxMemberCallExpr(
5555
callee(cxxMethodDecl(
56-
hasName("find"),
56+
hasName("find"), parameterCountIs(2),
5757
hasParameter(
5858
0, parmVarDecl(anyOf(hasType(StringType), hasType(CharStarType),
5959
hasType(CharType)))))),

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- BranchCloneCheck.cpp - clang-tidy --------------------------------===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- BranchCloneCheck.h - clang-tidy ------------------------*- C++ -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ void ProBoundsConstantArrayIndexCheck::registerPPCallbacks(
3838
void ProBoundsConstantArrayIndexCheck::registerMatchers(MatchFinder *Finder) {
3939
// Note: if a struct contains an array member, the compiler-generated
4040
// constructor has an arraySubscriptExpr.
41-
Finder->addMatcher(
42-
arraySubscriptExpr(
43-
hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type")))),
44-
hasIndex(expr().bind("index")), unless(hasAncestor(isImplicit())))
45-
.bind("expr"),
46-
this);
41+
Finder->addMatcher(arraySubscriptExpr(hasBase(ignoringImpCasts(hasType(
42+
constantArrayType().bind("type")))),
43+
hasIndex(expr().bind("index")),
44+
unless(hasAncestor(decl(isImplicit()))))
45+
.bind("expr"),
46+
this);
4747

4848
Finder->addMatcher(
4949
cxxOperatorCallExpr(

clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- UseTrailingReturnTypeCheck.cpp - clang-tidy-----------------------===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- UseTrailingReturnTypeCheck.h - clang-tidy---------------*- C++ -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/objc/SuperSelfCheck.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- SuperSelfCheck.cpp - clang-tidy ----------------------------------===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/objc/SuperSelfCheck.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- SuperSelfCheck.h - clang-tidy --------------------------*- C++ -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/readability/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ add_clang_library(clangTidyReadabilityModule
1313
ElseAfterReturnCheck.cpp
1414
FunctionCognitiveComplexityCheck.cpp
1515
FunctionSizeCheck.cpp
16+
IdentifierLengthCheck.cpp
1617
IdentifierNamingCheck.cpp
1718
ImplicitBoolConversionCheck.cpp
1819
InconsistentDeclarationParameterNameCheck.cpp

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- ConvertMemberFunctionsToStatic.cpp - clang-tidy ------------------===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===--- ConvertMemberFunctionsToStatic.h - clang-tidy ----------*- C++ -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
//===--- IdentifierLengthCheck.cpp - clang-tidy
2+
//-----------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#include "IdentifierLengthCheck.h"
11+
#include "../utils/OptionsUtils.h"
12+
#include "clang/AST/ASTContext.h"
13+
#include "clang/ASTMatchers/ASTMatchFinder.h"
14+
15+
using namespace clang::ast_matchers;
16+
17+
namespace clang {
18+
namespace tidy {
19+
namespace readability {
20+
21+
const unsigned DefaultMinimumVariableNameLength = 3;
22+
const unsigned DefaultMinimumLoopCounterNameLength = 2;
23+
const unsigned DefaultMinimumExceptionNameLength = 2;
24+
const unsigned DefaultMinimumParameterNameLength = 3;
25+
const char DefaultIgnoredLoopCounterNames[] = "^[ijk_]$";
26+
const char DefaultIgnoredVariableNames[] = "";
27+
const char DefaultIgnoredExceptionVariableNames[] = "^[e]$";
28+
const char DefaultIgnoredParameterNames[] = "^[n]$";
29+
30+
const char ErrorMessage[] =
31+
"%select{variable|exception variable|loop variable|"
32+
"parameter}0 name %1 is too short, expected at least %2 characters";
33+
34+
IdentifierLengthCheck::IdentifierLengthCheck(StringRef Name,
35+
ClangTidyContext *Context)
36+
: ClangTidyCheck(Name, Context),
37+
MinimumVariableNameLength(Options.get("MinimumVariableNameLength",
38+
DefaultMinimumVariableNameLength)),
39+
MinimumLoopCounterNameLength(Options.get(
40+
"MinimumLoopCounterNameLength", DefaultMinimumLoopCounterNameLength)),
41+
MinimumExceptionNameLength(Options.get(
42+
"MinimumExceptionNameLength", DefaultMinimumExceptionNameLength)),
43+
MinimumParameterNameLength(Options.get(
44+
"MinimumParameterNameLength", DefaultMinimumParameterNameLength)),
45+
IgnoredVariableNamesInput(
46+
Options.get("IgnoredVariableNames", DefaultIgnoredVariableNames)),
47+
IgnoredVariableNames(IgnoredVariableNamesInput),
48+
IgnoredLoopCounterNamesInput(Options.get("IgnoredLoopCounterNames",
49+
DefaultIgnoredLoopCounterNames)),
50+
IgnoredLoopCounterNames(IgnoredLoopCounterNamesInput),
51+
IgnoredExceptionVariableNamesInput(
52+
Options.get("IgnoredExceptionVariableNames",
53+
DefaultIgnoredExceptionVariableNames)),
54+
IgnoredExceptionVariableNames(IgnoredExceptionVariableNamesInput),
55+
IgnoredParameterNamesInput(
56+
Options.get("IgnoredParameterNames", DefaultIgnoredParameterNames)),
57+
IgnoredParameterNames(IgnoredParameterNamesInput) {}
58+
59+
void IdentifierLengthCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
60+
Options.store(Opts, "MinimumVariableNameLength", MinimumVariableNameLength);
61+
Options.store(Opts, "MinimumLoopCounterNameLength",
62+
MinimumLoopCounterNameLength);
63+
Options.store(Opts, "MinimumExceptionNameLength", MinimumExceptionNameLength);
64+
Options.store(Opts, "MinimumParameterNameLength", MinimumParameterNameLength);
65+
Options.store(Opts, "IgnoredLoopCounterNames", IgnoredLoopCounterNamesInput);
66+
Options.store(Opts, "IgnoredVariableNames", IgnoredVariableNamesInput);
67+
Options.store(Opts, "IgnoredExceptionVariableNames",
68+
IgnoredExceptionVariableNamesInput);
69+
Options.store(Opts, "IgnoredParameterNames", IgnoredParameterNamesInput);
70+
}
71+
72+
void IdentifierLengthCheck::registerMatchers(MatchFinder *Finder) {
73+
if (MinimumLoopCounterNameLength > 1)
74+
Finder->addMatcher(
75+
forStmt(hasLoopInit(declStmt(forEach(varDecl().bind("loopVar"))))),
76+
this);
77+
78+
if (MinimumExceptionNameLength > 1)
79+
Finder->addMatcher(varDecl(hasParent(cxxCatchStmt())).bind("exceptionVar"),
80+
this);
81+
82+
if (MinimumParameterNameLength > 1)
83+
Finder->addMatcher(parmVarDecl().bind("paramVar"), this);
84+
85+
if (MinimumVariableNameLength > 1)
86+
Finder->addMatcher(
87+
varDecl(unless(anyOf(hasParent(declStmt(hasParent(forStmt()))),
88+
hasParent(cxxCatchStmt()), parmVarDecl())))
89+
.bind("standaloneVar"),
90+
this);
91+
}
92+
93+
void IdentifierLengthCheck::check(const MatchFinder::MatchResult &Result) {
94+
const auto *StandaloneVar = Result.Nodes.getNodeAs<VarDecl>("standaloneVar");
95+
if (StandaloneVar) {
96+
if (!StandaloneVar->getIdentifier())
97+
return;
98+
99+
StringRef VarName = StandaloneVar->getName();
100+
101+
if (VarName.size() >= MinimumVariableNameLength ||
102+
IgnoredVariableNames.match(VarName))
103+
return;
104+
105+
diag(StandaloneVar->getLocation(), ErrorMessage)
106+
<< 0 << StandaloneVar << MinimumVariableNameLength;
107+
}
108+
109+
auto *ExceptionVarName = Result.Nodes.getNodeAs<VarDecl>("exceptionVar");
110+
if (ExceptionVarName) {
111+
if (!ExceptionVarName->getIdentifier())
112+
return;
113+
114+
StringRef VarName = ExceptionVarName->getName();
115+
if (VarName.size() >= MinimumExceptionNameLength ||
116+
IgnoredExceptionVariableNames.match(VarName))
117+
return;
118+
119+
diag(ExceptionVarName->getLocation(), ErrorMessage)
120+
<< 1 << ExceptionVarName << MinimumExceptionNameLength;
121+
}
122+
123+
const auto *LoopVar = Result.Nodes.getNodeAs<VarDecl>("loopVar");
124+
if (LoopVar) {
125+
if (!LoopVar->getIdentifier())
126+
return;
127+
128+
StringRef VarName = LoopVar->getName();
129+
130+
if (VarName.size() >= MinimumLoopCounterNameLength ||
131+
IgnoredLoopCounterNames.match(VarName))
132+
return;
133+
134+
diag(LoopVar->getLocation(), ErrorMessage)
135+
<< 2 << LoopVar << MinimumLoopCounterNameLength;
136+
}
137+
138+
const auto *ParamVar = Result.Nodes.getNodeAs<VarDecl>("paramVar");
139+
if (ParamVar) {
140+
if (!ParamVar->getIdentifier())
141+
return;
142+
143+
StringRef VarName = ParamVar->getName();
144+
145+
if (VarName.size() >= MinimumParameterNameLength ||
146+
IgnoredParameterNames.match(VarName))
147+
return;
148+
149+
diag(ParamVar->getLocation(), ErrorMessage)
150+
<< 3 << ParamVar << MinimumParameterNameLength;
151+
}
152+
}
153+
154+
} // namespace readability
155+
} // namespace tidy
156+
} // namespace clang

0 commit comments

Comments
 (0)