Skip to content

Commit 5a64d6b

Browse files
committed
Merge from 'master' to 'sycl-web' (#2)
CONFLICT (content): Merge conflict in README.md
2 parents dc447ec + cbe0ee1 commit 5a64d6b

File tree

570 files changed

+10274
-5549
lines changed

Some content is hidden

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

570 files changed

+10274
-5549
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ template <> struct MappingTraits<FileFilter> {
4747
IO.mapRequired("name", File.Name);
4848
IO.mapOptional("lines", File.LineRanges);
4949
}
50-
static StringRef validate(IO &io, FileFilter &File) {
50+
static std::string validate(IO &io, FileFilter &File) {
5151
if (File.Name.empty())
5252
return "No file name specified";
5353
for (const FileFilter::LineRange &Range : File.LineRanges) {
5454
if (Range.first <= 0 || Range.second <= 0)
5555
return "Invalid line range";
5656
}
57-
return StringRef();
57+
return "";
5858
}
5959
};
6060

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
2121
if (Init && !Init->isValueDependent()) {
2222
if (Node.isConstexpr())
2323
return true;
24-
return Node.checkInitIsICE();
24+
return Node.evaluateValue();
2525
}
2626
return false;
2727
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,21 @@ struct DenseMapInfo<
8585
clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId;
8686

8787
static inline ClassDefId getEmptyKey() {
88-
return ClassDefId(
89-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
90-
"EMPTY");
88+
return ClassDefId(DenseMapInfo<clang::SourceLocation>::getEmptyKey(),
89+
"EMPTY");
9190
}
9291

9392
static inline ClassDefId getTombstoneKey() {
94-
return ClassDefId(
95-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
96-
"TOMBSTONE");
93+
return ClassDefId(DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
94+
"TOMBSTONE");
9795
}
9896

9997
static unsigned getHashValue(ClassDefId Val) {
10098
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
10199
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
102100

103101
std::hash<ClassDefId::second_type> SecondHash;
104-
return Val.first.getRawEncoding() + SecondHash(Val.second);
102+
return Val.first.getHashValue() + SecondHash(Val.second);
105103
}
106104

107105
static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS) {

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ void UpgradeGoogletestCaseCheck::check(const MatchFinder::MatchResult &Result) {
298298
}
299299

300300
if (IsInInstantiation) {
301-
if (MatchedTemplateLocations.count(
302-
ReplacementRange.getBegin().getRawEncoding()) == 0) {
301+
if (MatchedTemplateLocations.count(ReplacementRange.getBegin()) == 0) {
303302
// For each location matched in a template instantiation, we check if
304303
// the location can also be found in `MatchedTemplateLocations`. If it
305304
// is not found, that means the expression did not create a match
@@ -313,8 +312,7 @@ void UpgradeGoogletestCaseCheck::check(const MatchFinder::MatchResult &Result) {
313312
if (IsInTemplate) {
314313
// We gather source locations from template matches not in template
315314
// instantiations for future matches.
316-
MatchedTemplateLocations.insert(
317-
ReplacementRange.getBegin().getRawEncoding());
315+
MatchedTemplateLocations.insert(ReplacementRange.getBegin());
318316
}
319317

320318
if (!AddFix) {

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class UpgradeGoogletestCaseCheck : public ClangTidyCheck {
3333
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3434

3535
private:
36-
llvm::DenseSet<unsigned> MatchedTemplateLocations;
36+
llvm::DenseSet<SourceLocation> MatchedTemplateLocations;
3737
};
3838

3939
} // namespace google

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,22 @@ struct DenseMapInfo<clang::tidy::RenamerClangTidyCheck::NamingCheckId> {
2828
using NamingCheckId = clang::tidy::RenamerClangTidyCheck::NamingCheckId;
2929

3030
static inline NamingCheckId getEmptyKey() {
31-
return NamingCheckId(
32-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
33-
"EMPTY");
31+
return NamingCheckId(DenseMapInfo<clang::SourceLocation>::getEmptyKey(),
32+
"EMPTY");
3433
}
3534

3635
static inline NamingCheckId getTombstoneKey() {
37-
return NamingCheckId(
38-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
39-
"TOMBSTONE");
36+
return NamingCheckId(DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
37+
"TOMBSTONE");
4038
}
4139

4240
static unsigned getHashValue(NamingCheckId Val) {
4341
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
4442
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
4543

4644
std::hash<NamingCheckId::second_type> SecondHash;
47-
return Val.first.getRawEncoding() + SecondHash(Val.second);
45+
return DenseMapInfo<clang::SourceLocation>::getHashValue(Val.first) +
46+
SecondHash(Val.second);
4847
}
4948

5049
static bool isEqual(const NamingCheckId &LHS, const NamingCheckId &RHS) {
@@ -173,8 +172,7 @@ void RenamerClangTidyCheck::addUsage(
173172
// is already in there
174173
RenamerClangTidyCheck::NamingCheckFailure &Failure =
175174
NamingCheckFailures[Decl];
176-
177-
if (!Failure.RawUsageLocs.insert(FixLocation.getRawEncoding()).second)
175+
if (!Failure.RawUsageLocs.insert(FixLocation).second)
178176
return;
179177

180178
if (!Failure.ShouldFix())
@@ -550,9 +548,8 @@ void RenamerClangTidyCheck::onEndOfTranslationUnit() {
550548
//
551549
// Other multi-token identifiers, such as operators are not checked at
552550
// all.
553-
Diag << FixItHint::CreateReplacement(
554-
SourceRange(SourceLocation::getFromRawEncoding(Loc)),
555-
Failure.Info.Fixup);
551+
Diag << FixItHint::CreateReplacement(SourceRange(Loc),
552+
Failure.Info.Fixup);
556553
}
557554
}
558555
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ class RenamerClangTidyCheck : public ClangTidyCheck {
9494

9595
ShouldFixStatus FixStatus = ShouldFixStatus::ShouldFix;
9696

97-
/// A set of all the identifier usages starting SourceLocation, in
98-
/// their encoded form.
99-
llvm::DenseSet<unsigned> RawUsageLocs;
97+
/// A set of all the identifier usages starting SourceLocation.
98+
llvm::DenseSet<SourceLocation> RawUsageLocs;
10099

101100
NamingCheckFailure() = default;
102101
};

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ class ExplicitReferenceCollector
10141014
}
10151015

10161016
bool VisitTypeLoc(TypeLoc TTL) {
1017-
if (TypeLocsToSkip.count(TTL.getBeginLoc().getRawEncoding()))
1017+
if (TypeLocsToSkip.count(TTL.getBeginLoc()))
10181018
return true;
10191019
visitNode(DynTypedNode::create(TTL));
10201020
return true;
@@ -1024,7 +1024,7 @@ class ExplicitReferenceCollector
10241024
// ElaboratedTypeLoc will reports information for its inner type loc.
10251025
// Otherwise we loose information about inner types loc's qualifier.
10261026
TypeLoc Inner = L.getNamedTypeLoc().getUnqualifiedLoc();
1027-
TypeLocsToSkip.insert(Inner.getBeginLoc().getRawEncoding());
1027+
TypeLocsToSkip.insert(Inner.getBeginLoc());
10281028
return RecursiveASTVisitor::TraverseElaboratedTypeLoc(L);
10291029
}
10301030

@@ -1090,7 +1090,7 @@ class ExplicitReferenceCollector
10901090
visitNode(DynTypedNode::create(L));
10911091
// Inner type is missing information about its qualifier, skip it.
10921092
if (auto TL = L.getTypeLoc())
1093-
TypeLocsToSkip.insert(TL.getBeginLoc().getRawEncoding());
1093+
TypeLocsToSkip.insert(TL.getBeginLoc());
10941094
return RecursiveASTVisitor::TraverseNestedNameSpecifierLoc(L);
10951095
}
10961096

@@ -1163,7 +1163,7 @@ class ExplicitReferenceCollector
11631163
llvm::function_ref<void(ReferenceLoc)> Out;
11641164
/// TypeLocs starting at these locations must be skipped, see
11651165
/// TraverseElaboratedTypeSpecifierLoc for details.
1166-
llvm::DenseSet</*SourceLocation*/ unsigned> TypeLocsToSkip;
1166+
llvm::DenseSet<SourceLocation> TypeLocsToSkip;
11671167
};
11681168
} // namespace
11691169

clang-tools-extra/clangd/Format.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ void closeBrackets(std::string &Code, const format::FormatStyle &Style) {
2626
SourceManagerForFile FileSM("dummy.cpp", Code);
2727
auto &SM = FileSM.get();
2828
FileID FID = SM.getMainFileID();
29-
Lexer Lex(FID, SM.getBuffer(FID), SM, format::getFormattingLangOpts(Style));
29+
Lexer Lex(FID, SM.getBufferOrFake(FID), SM,
30+
format::getFormattingLangOpts(Style));
3031
Token Tok;
3132
std::vector<char> Brackets;
3233
while (!Lex.LexFromRawLexer(Tok)) {

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,12 @@ bool fromJSON(const llvm::json::Value &E, TraceLevel &Out, llvm::json::Path P) {
179179
if (*S == "off") {
180180
Out = TraceLevel::Off;
181181
return true;
182-
} else if (*S == "messages") {
182+
}
183+
if (*S == "messages") {
183184
Out = TraceLevel::Messages;
184185
return true;
185-
} else if (*S == "verbose") {
186+
}
187+
if (*S == "verbose") {
186188
Out = TraceLevel::Verbose;
187189
return true;
188190
}
@@ -319,7 +321,8 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
319321
if (auto *Item = Completion->getObject("completionItem")) {
320322
if (auto SnippetSupport = Item->getBoolean("snippetSupport"))
321323
R.CompletionSnippets = *SnippetSupport;
322-
if (auto DocumentationFormat = Item->getArray("documentationFormat")) {
324+
if (const auto *DocumentationFormat =
325+
Item->getArray("documentationFormat")) {
323326
for (const auto &Format : *DocumentationFormat) {
324327
if (fromJSON(Format, R.CompletionDocumentationFormat, P))
325328
break;
@@ -645,7 +648,7 @@ bool fromJSON(const llvm::json::Value &Params, ExecuteCommandParams &R,
645648
if (!O || !O.map("command", R.command))
646649
return false;
647650

648-
auto Args = Params.getAsObject()->getArray("arguments");
651+
const auto *Args = Params.getAsObject()->getArray("arguments");
649652
if (R.command == ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND) {
650653
return Args && Args->size() == 1 &&
651654
fromJSON(Args->front(), R.workspaceEdit,

0 commit comments

Comments
 (0)