Skip to content

Commit 09bab5d

Browse files
authored
Merge branch 'sycl' into private/vlazarev/deps_docs
2 parents 590a9b8 + ea2f012 commit 09bab5d

File tree

2,312 files changed

+63864
-24986
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,312 files changed

+63864
-24986
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44

55
Intel staging area for llvm.org contribution.
66
Home for Intel LLVM-based projects:
7-
- oneAPI Data Parallel C++ compiler - see **sycl** branch. More information on
7+
8+
* oneAPI Data Parallel C++ compiler - see **sycl** branch. More information on
89
oneAPI and DPC++ is available at
910
[https://www.oneapi.com/](https://www.oneapi.com/)
10-
- [![Linux Post Commit Checks](https://github.com/intel/llvm/workflows/Linux%20Post%20Commit%20Checks/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Linux+Post+Commit+Checks%22)
11-
[![Generate Doxygen documentation](https://github.com/intel/llvm/workflows/Generate%20Doxygen%20documentation/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Generate+Doxygen+documentation%22)
12-
13-
11+
* [![Linux Post Commit Checks](https://github.com/intel/llvm/workflows/Linux%20Post%20Commit%20Checks/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Linux+Post+Commit+Checks%22)
12+
[![Generate Doxygen documentation](https://github.com/intel/llvm/workflows/Generate%20Doxygen%20documentation/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Generate+Doxygen+documentation%22)
1413

1514
## License
15+
1616
See [LICENSE.txt](sycl/LICENSE.TXT) for details.
1717

1818
## Contributing
19+
1920
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
2021

2122
## Sub-projects Documentation
22-
- oneAPI Data Parallel C++ compiler - See
23-
[GetStartedGuide.md](sycl/doc/GetStartedGuide.md)
23+
24+
* oneAPI Data Parallel C++ compiler - See
25+
[GetStartedGuide.md](sycl/doc/GetStartedGuide.md)
2426

2527
## DPC++ extensions
2628

@@ -29,4 +31,3 @@ SYCL\* standards. DPC++ extends these standards with a number of extensions,
2931
which can be found in [sycl/doc/extensions](sycl/doc/extensions) directory.
3032

3133
\*Other names and brands may be claimed as the property of others.
32-

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ class NameLookup {
207207
/// flag indicating the multiple resolutions.
208208
NameLookup findDeclInBases(const CXXRecordDecl &Parent, StringRef DeclName,
209209
bool AggressiveTemplateLookup) {
210+
if (!Parent.hasDefinition())
211+
return NameLookup(nullptr);
210212
if (const NamedDecl *InClassRef = findDecl(Parent, DeclName))
211213
return NameLookup(InClassRef);
212214
const NamedDecl *Found = nullptr;

clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ void TransformerClangTidyCheck::check(
112112
}
113113
}
114114

115+
void TransformerClangTidyCheck::storeOptions(
116+
ClangTidyOptions::OptionMap &Opts) {
117+
Options.store(Opts, "IncludeStyle", IncludeStyle,
118+
IncludeSorter::getMapping());
119+
}
120+
115121
} // namespace utils
116122
} // namespace tidy
117123
} // namespace clang

clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class TransformerClangTidyCheck : public ClangTidyCheck {
6767
void registerMatchers(ast_matchers::MatchFinder *Finder) final;
6868
void check(const ast_matchers::MatchFinder::MatchResult &Result) final;
6969

70+
/// Derived classes that override this function should call this method from
71+
/// the overridden method.
72+
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
73+
7074
private:
7175
Optional<transformer::RewriteRule> Rule;
7276
const IncludeSorter::IncludeStyle IncludeStyle;

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ SignatureHelp signatureHelp(PathRef FileName,
17771777
const SymbolIndex *Index) {
17781778
auto Offset = positionToOffset(Contents, Pos);
17791779
if (!Offset) {
1780-
elog("Code completion position was invalid {0}", Offset.takeError());
1780+
elog("Signature help position was invalid {0}", Offset.takeError());
17811781
return SignatureHelp();
17821782
}
17831783
SignatureHelp Result;

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
8282
CI->getPreprocessorOpts().PCHThroughHeader.clear();
8383
CI->getPreprocessorOpts().PCHWithHdrStop = false;
8484
CI->getPreprocessorOpts().PCHWithHdrStopCreate = false;
85+
86+
// Recovery expression currently only works for C++.
87+
if (CI->getLangOpts()->CPlusPlus)
88+
CI->getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
8589
return CI;
8690
}
8791

clang-tools-extra/clangd/Diagnostics.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ Range diagnosticRange(const clang::Diagnostic &D, const LangOptions &L) {
124124
bool adjustDiagFromHeader(Diag &D, const clang::Diagnostic &Info,
125125
const LangOptions &LangOpts) {
126126
// We only report diagnostics with at least error severity from headers.
127-
if (D.Severity < DiagnosticsEngine::Level::Error)
127+
// Use default severity to avoid noise with -Werror.
128+
if (!Info.getDiags()->getDiagnosticIDs()->isDefaultMappingAsError(
129+
Info.getID()))
128130
return false;
129131

130132
const SourceManager &SM = Info.getSourceManager();
@@ -514,7 +516,8 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
514516
if (Info.getLocation().isInvalid()) {
515517
// Handle diagnostics coming from command-line arguments. The source manager
516518
// is *not* available at this point, so we cannot use it.
517-
if (DiagLevel < DiagnosticsEngine::Level::Error) {
519+
if (!Info.getDiags()->getDiagnosticIDs()->isDefaultMappingAsError(
520+
Info.getID())) {
518521
IgnoreDiagnostics::log(DiagLevel, Info);
519522
return; // non-errors add too much noise, do not show them.
520523
}

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
262262
const PrecompiledPreamble *PreamblePCH =
263263
Preamble ? &Preamble->Preamble : nullptr;
264264

265-
// Recovery expression currently only works for C++.
266-
if (CI->getLangOpts()->CPlusPlus)
267-
CI->getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
268265
// This is on-by-default in windows to allow parsing SDK headers, but it
269266
// breaks many features. Disable it for the main-file (not preamble).
270267
CI->getLangOpts()->DelayedTemplateParsing = false;
@@ -314,18 +311,12 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
314311
std::string CheckName = CTContext->getCheckName(Info.getID());
315312
bool IsClangTidyDiag = !CheckName.empty();
316313
if (IsClangTidyDiag) {
317-
// Check for warning-as-error.
318-
// We deliberately let this take precedence over suppression comments
319-
// to match clang-tidy's behaviour.
320-
if (DiagLevel == DiagnosticsEngine::Warning &&
321-
CTContext->treatAsError(CheckName)) {
322-
return DiagnosticsEngine::Error;
323-
}
324-
325314
// Check for suppression comment. Skip the check for diagnostics not
326315
// in the main file, because we don't want that function to query the
327316
// source buffer for preamble files. For the same reason, we ask
328317
// shouldSuppressDiagnostic to avoid I/O.
318+
// We let suppression comments take precedence over warning-as-error
319+
// to match clang-tidy's behaviour.
329320
bool IsInsideMainFile =
330321
Info.hasSourceManager() &&
331322
isInsideMainFile(Info.getLocation(), Info.getSourceManager());
@@ -334,6 +325,12 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
334325
/*AllowIO=*/false)) {
335326
return DiagnosticsEngine::Ignored;
336327
}
328+
329+
// Check for warning-as-error.
330+
if (DiagLevel == DiagnosticsEngine::Warning &&
331+
CTContext->treatAsError(CheckName)) {
332+
return DiagnosticsEngine::Error;
333+
}
337334
}
338335
}
339336
return DiagLevel;

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
219219
// to read back. We rely on dynamic index for the comments instead.
220220
CI.getPreprocessorOpts().WriteCommentListToPCH = false;
221221

222-
// Recovery expression currently only works for C++.
223-
if (CI.getLangOpts()->CPlusPlus)
224-
CI.getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
225-
226222
CppFilePreambleCallbacks SerializedDeclsCollector(FileName, PreambleCallback);
227223
if (Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory)) {
228224
log("Couldn't set working directory when building the preamble.");

clang-tools-extra/clangd/Selection.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "Selection.h"
1010
#include "SourceCode.h"
1111
#include "support/Logger.h"
12+
#include "support/Trace.h"
1213
#include "clang/AST/ASTTypeTraits.h"
1314
#include "clang/AST/Decl.h"
1415
#include "clang/AST/DeclCXX.h"
@@ -35,6 +36,21 @@ namespace {
3536
using Node = SelectionTree::Node;
3637
using ast_type_traits::DynTypedNode;
3738

39+
// Measure the fraction of selections that were enabled by recovery AST.
40+
void recordMetrics(const SelectionTree &S) {
41+
static constexpr trace::Metric SelectionUsedRecovery(
42+
"selection_recovery", trace::Metric::Distribution);
43+
const auto *Common = S.commonAncestor();
44+
for (const auto *N = Common; N; N = N->Parent) {
45+
if (N->ASTNode.get<RecoveryExpr>()) {
46+
SelectionUsedRecovery.record(1); // used recovery ast.
47+
return;
48+
}
49+
}
50+
if (Common)
51+
SelectionUsedRecovery.record(0); // unused.
52+
}
53+
3854
// An IntervalSet maintains a set of disjoint subranges of an array.
3955
//
4056
// Initially, it contains the entire array.
@@ -774,6 +790,7 @@ SelectionTree::SelectionTree(ASTContext &AST, const syntax::TokenBuffer &Tokens,
774790
.printToString(SM));
775791
Nodes = SelectionVisitor::collect(AST, Tokens, PrintPolicy, Begin, End, FID);
776792
Root = Nodes.empty() ? nullptr : &Nodes.front();
793+
recordMetrics(*this);
777794
dlog("Built selection tree\n{0}", *this);
778795
}
779796

0 commit comments

Comments
 (0)