Skip to content

Commit bba4c55

Browse files
Merge branch 'sycl' of https://github.com/intel/llvm into enable_esimd_emu_build
2 parents 139a549 + 90c8f05 commit bba4c55

File tree

3,009 files changed

+100430
-38909
lines changed

Some content is hidden

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

3,009 files changed

+100430
-38909
lines changed

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ CheckOptions:
1616
value: CamelCase
1717
- key: readability-identifier-naming.IgnoreMainLikeFunctions
1818
value: 1
19-
19+
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
20+
value: 1

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ llvm/ @intel/dpcpp-tools-reviewers
4848
clang/tools/clang-offload-*/ @intel/dpcpp-tools-reviewers
4949

5050
# Explicit SIMD
51-
SYCLLowerIR/ @intel/dpcpp-esimd-reviewers
51+
ESIMD/ @intel/dpcpp-esimd-reviewers
5252
esimd/ @intel/dpcpp-esimd-reviewers
5353
sycl/include/sycl/ext/intel/experimental/esimd.hpp @intel/dpcpp-esimd-reviewers
5454
sycl/doc/extensions/ExplicitSIMD/ @intel/dpcpp-esimd-reviewers
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Issue Subscriber
2+
3+
on:
4+
issues:
5+
types:
6+
- labeled
7+
8+
jobs:
9+
auto-subscribe:
10+
runs-on: ubuntu-latest
11+
if: github.repository == 'llvm/llvm-project'
12+
steps:
13+
- name: Update watchers
14+
uses: actions/github-script@v5
15+
with:
16+
github-token: ${{ secrets.ISSUE_MENTION_SECRET }}
17+
script: |
18+
const teamname = "issue-subscribers-" + context.payload.label.name.replace(/ /g, "-").replace(":","-").replace("/","-");
19+
const comment = "@llvm/" + teamname;
20+
try {
21+
// This will throw an exception if the team does not exist and no
22+
// comment will be created.
23+
team = await github.rest.teams.getByName({
24+
org: context.repo.owner,
25+
team_slug: teamname
26+
});
27+
github.rest.issues.createComment({
28+
issue_number: context.issue.number,
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
body: comment
32+
});
33+
} catch (e){
34+
console.log(e);
35+
}

clang-tools-extra/clang-doc/Mapper.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "llvm/ADT/StringExtras.h"
1515
#include "llvm/Support/Error.h"
1616

17-
using clang::comments::FullComment;
18-
1917
namespace clang {
2018
namespace doc {
2119

@@ -68,7 +66,7 @@ bool MapASTVisitor::VisitCXXMethodDecl(const CXXMethodDecl *D) {
6866

6967
bool MapASTVisitor::VisitFunctionDecl(const FunctionDecl *D) {
7068
// Don't visit CXXMethodDecls twice
71-
if (dyn_cast<CXXMethodDecl>(D))
69+
if (isa<CXXMethodDecl>(D))
7270
return true;
7371
return mapDecl(D);
7472
}

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ populateParentNamespaces(llvm::SmallVector<Reference, 4> &Namespaces,
382382
// corresponds to a Record and if it doesn't have any namespace (because this
383383
// means it's in the global namespace). Also if its outermost namespace is a
384384
// record because that record matches the previous condition mentioned.
385-
if ((Namespaces.empty() && dyn_cast<RecordDecl>(D)) ||
385+
if ((Namespaces.empty() && isa<RecordDecl>(D)) ||
386386
(!Namespaces.empty() && Namespaces.back().RefType == InfoType::IT_record))
387387
Namespaces.emplace_back(SymbolID(), "GlobalNamespace",
388388
InfoType::IT_namespace);
@@ -419,10 +419,10 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
419419
populateSymbolInfo(I, D, FC, LineNumber, Filename, IsFileInRootDir,
420420
IsInAnonymousNamespace);
421421
if (const auto *T = getDeclForType(D->getReturnType())) {
422-
if (dyn_cast<EnumDecl>(T))
422+
if (isa<EnumDecl>(T))
423423
I.ReturnType = TypeInfo(getUSRForDecl(T), T->getNameAsString(),
424424
InfoType::IT_enum, getInfoRelativePath(T));
425-
else if (dyn_cast<RecordDecl>(T))
425+
else if (isa<RecordDecl>(T))
426426
I.ReturnType = TypeInfo(getUSRForDecl(T), T->getNameAsString(),
427427
InfoType::IT_record, getInfoRelativePath(T));
428428
} else {

clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <string>
1616
#include <vector>
1717

18-
using clang::find_all_symbols::SymbolInfo;
1918
using clang::find_all_symbols::SymbolAndSignals;
2019

2120
namespace clang {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "llvm/Support/raw_ostream.h"
1414

1515
using llvm::yaml::MappingTraits;
16-
using llvm::yaml::IO;
17-
using llvm::yaml::Input;
1816
using ContextType = clang::find_all_symbols::SymbolInfo::ContextType;
1917
using clang::find_all_symbols::SymbolInfo;
2018
using clang::find_all_symbols::SymbolAndSignals;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location,
719719
}
720720

721721
if (!*Context.getOptions().SystemHeaders &&
722-
Sources.isInSystemHeader(Location))
722+
(Sources.isInSystemHeader(Location) || Sources.isInSystemMacro(Location)))
723723
return;
724724

725725
// FIXME: We start with a conservative approach here, but the actual type of

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ void DurationFactoryScaleCheck::check(const MatchFinder::MatchResult &Result) {
221221
tooling::fixit::getText(*Remainder, *Result.Context) + ")")
222222
.str());
223223
}
224-
return;
225224
}
226225

227226
} // namespace abseil

clang-tools-extra/clang-tidy/abseil/DurationRewriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ AST_MATCHER_FUNCTION_P(ast_matchers::internal::Matcher<Stmt>,
138138
} // namespace tidy
139139
} // namespace clang
140140

141-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONCOMPARISONCHECK_H
141+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONREWRITER_H

clang-tools-extra/clang-tidy/add_new_check.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,20 @@ def has_auto_fix(check_name):
324324
dirname, _, check_name = check_name.partition("-")
325325

326326
checker_code = get_actual_filename(os.path.join(clang_tidy_path, dirname),
327-
get_camel_name(check_name) + '.cpp')
328-
327+
get_camel_check_name(check_name) + '.cpp')
329328
if not os.path.isfile(checker_code):
330-
return ""
329+
# Some older checks don't end with 'Check.cpp'
330+
checker_code = get_actual_filename(os.path.join(clang_tidy_path, dirname),
331+
get_camel_name(check_name) + '.cpp')
332+
if not os.path.isfile(checker_code):
333+
return ''
331334

332335
with io.open(checker_code, encoding='utf8') as f:
333336
code = f.read()
334-
if 'FixItHint' in code or "ReplacementText" in code or "fixit" in code:
335-
# Some simple heuristics to figure out if a checker has an autofix or not.
336-
return ' "Yes"'
337+
for needle in ['FixItHint', 'ReplacementText', 'fixit', 'TransformerClangTidyCheck']:
338+
if needle in code:
339+
# Some simple heuristics to figure out if a checker has an autofix or not.
340+
return ' "Yes"'
337341
return ""
338342

339343
def process_doc(doc_file):
@@ -416,7 +420,11 @@ def write_docs(module_path, module, check_name):
416420

417421
def get_camel_name(check_name):
418422
return ''.join(map(lambda elem: elem.capitalize(),
419-
check_name.split('-'))) + 'Check'
423+
check_name.split('-')))
424+
425+
426+
def get_camel_check_name(check_name):
427+
return get_camel_name(check_name) + 'Check'
420428

421429

422430
def main():
@@ -458,7 +466,7 @@ def main():
458466

459467
module = args.module
460468
check_name = args.check
461-
check_name_camel = get_camel_name(check_name)
469+
check_name_camel = get_camel_check_name(check_name)
462470
if check_name.startswith(module):
463471
print('Check name "%s" must not start with the module "%s". Exiting.' % (
464472
check_name, module))

clang-tools-extra/clang-tidy/android/CloexecCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void CloexecCheck::insertStringFlag(
8787

8888
// Check if the <Mode> may be in the mode string.
8989
const auto *ModeStr = dyn_cast<StringLiteral>(ModeArg->IgnoreParenCasts());
90-
if (!ModeStr || (ModeStr->getString().find(Mode) != StringRef::npos))
90+
if (!ModeStr || ModeStr->getString().contains(Mode))
9191
return;
9292

9393
std::string ReplacementText = buildFixMsgForStringFlag(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static StringRef exprToStr(const Expr *E,
144144

145145
return Lexer::getSourceText(
146146
CharSourceRange::getTokenRange(E->getSourceRange()),
147-
*Result.SourceManager, Result.Context->getLangOpts(), 0);
147+
*Result.SourceManager, Result.Context->getLangOpts(), nullptr);
148148
}
149149

150150
// Returns the proper token based end location of \p E.
@@ -477,7 +477,7 @@ static void insertNullTerminatorExpr(StringRef Name,
477477
FunctionExpr->getBeginLoc());
478478
StringRef SpaceBeforeStmtStr = Lexer::getSourceText(
479479
CharSourceRange::getCharRange(SpaceRange), *Result.SourceManager,
480-
Result.Context->getLangOpts(), 0);
480+
Result.Context->getLangOpts(), nullptr);
481481

482482
SmallString<128> NewAddNullTermExprStr;
483483
NewAddNullTermExprStr =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static std::string collapseConsecutive(StringRef Str, char C) {
6464
static bool hasReservedDoubleUnderscore(StringRef Name,
6565
const LangOptions &LangOpts) {
6666
if (LangOpts.CPlusPlus)
67-
return Name.find("__") != StringRef::npos;
67+
return Name.contains("__");
6868
return Name.startswith("__");
6969
}
7070

clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void LimitedRandomnessCheck::registerMatchers(MatchFinder *Finder) {
2424
}
2525

2626
void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
27-
std::string Msg = "";
27+
std::string Msg;
2828
if (getLangOpts().CPlusPlus)
2929
Msg = "; use C++11 random library instead";
3030

clang-tools-extra/clang-tidy/cert/NonTrivialTypesLibcMemoryCallsCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ class NonTrivialTypesLibcMemoryCallsCheck : public ClangTidyCheck {
4141
} // namespace tidy
4242
} // namespace clang
4343

44-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_NOTTRIVIALTYPESLIBCMEMORYCALLSCHECK_H
44+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_NONTRIVIALTYPESLIBCMEMORYCALLSCHECK_H

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

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
1212
#include "clang/ASTMatchers/ASTMatchers.h"
1313
#include "clang/Basic/TargetInfo.h"
14+
#include "clang/Lex/PPCallbacks.h"
15+
#include "clang/Lex/Preprocessor.h"
16+
#include "clang/Lex/Token.h"
1417

1518
using namespace clang::ast_matchers;
1619

@@ -57,6 +60,10 @@ static constexpr StringRef AllowedVariadics[] = {
5760
// clang-format on
5861
};
5962

63+
static constexpr StringRef VaArgWarningMessage =
64+
"do not use va_arg to define c-style vararg functions; "
65+
"use variadic templates instead";
66+
6067
namespace {
6168
AST_MATCHER(QualType, isVAList) {
6269
ASTContext &Context = Finder->getASTContext();
@@ -106,6 +113,21 @@ AST_MATCHER_P(AdjustedType, hasOriginalType,
106113
ast_matchers::internal::Matcher<QualType>, InnerType) {
107114
return InnerType.matches(Node.getOriginalType(), Finder, Builder);
108115
}
116+
117+
class VaArgPPCallbacks : public PPCallbacks {
118+
public:
119+
VaArgPPCallbacks(ProTypeVarargCheck *Check) : Check(Check) {}
120+
121+
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
122+
SourceRange Range, const MacroArgs *Args) override {
123+
if (MacroNameTok.getIdentifierInfo()->getName() == "va_arg") {
124+
Check->diag(MacroNameTok.getLocation(), VaArgWarningMessage);
125+
}
126+
}
127+
128+
private:
129+
ProTypeVarargCheck *Check;
130+
};
109131
} // namespace
110132

111133
void ProTypeVarargCheck::registerMatchers(MatchFinder *Finder) {
@@ -125,6 +147,12 @@ void ProTypeVarargCheck::registerMatchers(MatchFinder *Finder) {
125147
this);
126148
}
127149

150+
void ProTypeVarargCheck::registerPPCallbacks(const SourceManager &SM,
151+
Preprocessor *PP,
152+
Preprocessor *ModuleExpanderPP) {
153+
PP->addPPCallbacks(std::make_unique<VaArgPPCallbacks>(this));
154+
}
155+
128156
static bool hasSingleVariadicArgumentWithValue(const CallExpr *C, uint64_t I) {
129157
const auto *FDecl = dyn_cast<FunctionDecl>(C->getCalleeDecl());
130158
if (!FDecl)
@@ -153,9 +181,7 @@ void ProTypeVarargCheck::check(const MatchFinder::MatchResult &Result) {
153181
}
154182

155183
if (const auto *Matched = Result.Nodes.getNodeAs<Expr>("va_use")) {
156-
diag(Matched->getExprLoc(),
157-
"do not use va_arg to define c-style vararg functions; "
158-
"use variadic templates instead");
184+
diag(Matched->getExprLoc(), VaArgWarningMessage);
159185
}
160186

161187
if (const auto *Matched = Result.Nodes.getNodeAs<VarDecl>("va_list")) {

clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class ProTypeVarargCheck : public ClangTidyCheck {
2828
return LangOpts.CPlusPlus;
2929
}
3030
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
31+
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
32+
Preprocessor *ModuleExpanderPP) override;
3133
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3234
};
3335

clang-tools-extra/clang-tidy/llvmlibc/ImplementationInNamespaceCheck.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ void ImplementationInNamespaceCheck::check(
4141
diag(MatchedDecl->getLocation(),
4242
"declaration must be declared within the '%0' namespace")
4343
<< RequiredNamespace;
44-
return;
4544
}
4645

4746
} // namespace llvm_libc

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool LoopConvertCheck::isConvertible(ASTContext *Context,
829829
} else if (FixerKind == LFK_PseudoArray) {
830830
// This call is required to obtain the container.
831831
const auto *EndCall = Nodes.getNodeAs<CXXMemberCallExpr>(EndCallName);
832-
if (!EndCall || !dyn_cast<MemberExpr>(EndCall->getCallee()))
832+
if (!EndCall || !isa<MemberExpr>(EndCall->getCallee()))
833833
return false;
834834
}
835835
return true;

0 commit comments

Comments
 (0)