Skip to content

Commit 51b93d5

Browse files
committed
Merge from 'main' to 'sycl-web' (182 commits)
CONFLICT (content): Merge conflict in llvm/test/Transforms/Util/add-TLI-mappings.ll
2 parents ffacff7 + 211cf8a commit 51b93d5

File tree

772 files changed

+62689
-8144
lines changed

Some content is hidden

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

772 files changed

+62689
-8144
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,19 @@ void RewriteInstance::discoverFileObjects() {
966966
if (Name.empty()) {
967967
UniqueName = "ANONYMOUS." + std::to_string(AnonymousId++);
968968
} else if (cantFail(Symbol.getFlags()) & SymbolRef::SF_Global) {
969-
assert(!BC->getBinaryDataByName(Name) && "global name not unique");
969+
if (const BinaryData *BD = BC->getBinaryDataByName(Name)) {
970+
if (BD->getSize() == ELFSymbolRef(Symbol).getSize() &&
971+
BD->getAddress() == Address) {
972+
if (opts::Verbosity > 1)
973+
errs() << "BOLT-WARNING: ignoring duplicate global symbol " << Name
974+
<< "\n";
975+
// Ignore duplicate entry - possibly a bug in the linker
976+
continue;
977+
}
978+
errs() << "BOLT-ERROR: bad input binary, global symbol \"" << Name
979+
<< "\" is not unique\n";
980+
exit(1);
981+
}
970982
UniqueName = Name;
971983
} else {
972984
// If we have a local file name, we should create 2 variants for the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace google {
1717
namespace readability {
1818

1919
// Check for underscores in the names of googletest tests, per
20-
// https://github.com/google/googletest/blob/master/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
20+
// https://google.github.io/googletest/faq.html#why-should-test-suite-names-and-test-names-not-contain-underscore
2121
///
2222
/// For the user-facing documentation see:
2323
/// http://clang.llvm.org/extra/clang-tidy/checks/google/readability-avoid-underscore-in-googletest-name.html

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,23 @@ void UseEqualsDefaultCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
217217
Options.store(Opts, "IgnoreMacros", IgnoreMacros);
218218
}
219219

220+
namespace {
221+
AST_MATCHER(CXXMethodDecl, isOutOfLine) { return Node.isOutOfLine(); }
222+
} // namespace
223+
220224
void UseEqualsDefaultCheck::registerMatchers(MatchFinder *Finder) {
221225
// Skip unions/union-like classes since their constructors behave differently
222226
// when defaulted vs. empty.
223227
auto IsUnionLikeClass = recordDecl(
224228
anyOf(isUnion(),
225229
has(fieldDecl(isImplicit(), hasType(cxxRecordDecl(isUnion()))))));
226230

231+
const LangOptions &LangOpts = getLangOpts();
232+
auto IsPublicOrOutOfLineUntilCPP20 =
233+
LangOpts.CPlusPlus20
234+
? cxxConstructorDecl()
235+
: cxxConstructorDecl(anyOf(isOutOfLine(), isPublic()));
236+
227237
// Destructor.
228238
Finder->addMatcher(
229239
cxxDestructorDecl(unless(hasParent(IsUnionLikeClass)), isDefinition())
@@ -235,7 +245,8 @@ void UseEqualsDefaultCheck::registerMatchers(MatchFinder *Finder) {
235245
anyOf(
236246
// Default constructor.
237247
allOf(unless(hasAnyConstructorInitializer(isWritten())),
238-
unless(isVariadic()), parameterCountIs(0)),
248+
unless(isVariadic()), parameterCountIs(0),
249+
IsPublicOrOutOfLineUntilCPP20),
239250
// Copy constructor.
240251
allOf(isCopyConstructor(),
241252
// Discard constructors that can be used as a copy

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,29 @@ class CollectExtraHighlightings
649649
return true;
650650
}
651651

652+
bool VisitCXXDestructorDecl(CXXDestructorDecl *D) {
653+
if (auto *TI = D->getNameInfo().getNamedTypeInfo()) {
654+
SourceLocation Loc = TI->getTypeLoc().getBeginLoc();
655+
H.addExtraModifier(Loc, HighlightingModifier::ConstructorOrDestructor);
656+
H.addExtraModifier(Loc, HighlightingModifier::Declaration);
657+
if (D->isThisDeclarationADefinition())
658+
H.addExtraModifier(Loc, HighlightingModifier::Definition);
659+
}
660+
return true;
661+
}
662+
663+
bool VisitCXXMemberCallExpr(CXXMemberCallExpr *CE) {
664+
if (isa<CXXDestructorDecl>(CE->getMethodDecl())) {
665+
if (auto *ME = dyn_cast<MemberExpr>(CE->getCallee())) {
666+
if (auto *TI = ME->getMemberNameInfo().getNamedTypeInfo()) {
667+
H.addExtraModifier(TI->getTypeLoc().getBeginLoc(),
668+
HighlightingModifier::ConstructorOrDestructor);
669+
}
670+
}
671+
}
672+
return true;
673+
}
674+
652675
bool VisitDeclaratorDecl(DeclaratorDecl *D) {
653676
auto *AT = D->getType()->getContainedAutoType();
654677
if (!AT)
@@ -879,6 +902,8 @@ std::vector<HighlightingToken> getSemanticHighlightings(ParsedAST &AST) {
879902
Tok.addModifier(HighlightingModifier::DefaultLibrary);
880903
if (Decl->isDeprecated())
881904
Tok.addModifier(HighlightingModifier::Deprecated);
905+
if (isa<CXXConstructorDecl>(Decl))
906+
Tok.addModifier(HighlightingModifier::ConstructorOrDestructor);
882907
if (R.IsDecl) {
883908
// Do not treat an UnresolvedUsingValueDecl as a declaration.
884909
// It's more common to think of it as a reference to the
@@ -960,6 +985,8 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, HighlightingModifier K) {
960985
return OS << "decl"; // abbreviation for common case
961986
case HighlightingModifier::Definition:
962987
return OS << "def"; // abbrevation for common case
988+
case HighlightingModifier::ConstructorOrDestructor:
989+
return OS << "constrDestr";
963990
default:
964991
return OS << toSemanticTokenModifier(K);
965992
}
@@ -1111,6 +1138,8 @@ llvm::StringRef toSemanticTokenModifier(HighlightingModifier Modifier) {
11111138
return "defaultLibrary";
11121139
case HighlightingModifier::UsedAsMutableReference:
11131140
return "usedAsMutableReference"; // nonstandard
1141+
case HighlightingModifier::ConstructorOrDestructor:
1142+
return "constructorOrDestructor"; // nonstandard
11141143
case HighlightingModifier::FunctionScope:
11151144
return "functionScope"; // nonstandard
11161145
case HighlightingModifier::ClassScope:

clang-tools-extra/clangd/SemanticHighlighting.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum class HighlightingModifier {
7171
DependentName,
7272
DefaultLibrary,
7373
UsedAsMutableReference,
74+
ConstructorOrDestructor,
7475

7576
FunctionScope,
7677
ClassScope,

clang-tools-extra/clangd/test/initialize-params.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
# CHECK-NEXT: "dependentName",
6969
# CHECK-NEXT: "defaultLibrary",
7070
# CHECK-NEXT: "usedAsMutableReference",
71+
# CHECK-NEXT: "constructorOrDestructor",
7172
# CHECK-NEXT: "functionScope",
7273
# CHECK-NEXT: "classScope",
7374
# CHECK-NEXT: "fileScope",

clang-tools-extra/clangd/test/semantic-tokens.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# CHECK-NEXT: 4,
2424
# CHECK-NEXT: 1,
2525
# CHECK-NEXT: 0,
26-
# CHECK-NEXT: 16387
26+
# CHECK-NEXT: 32771
2727
# CHECK-NEXT: ],
2828
# CHECK-NEXT: "resultId": "1"
2929
# CHECK-NEXT: }
@@ -49,7 +49,7 @@
4949
# CHECK-NEXT: 4,
5050
# CHECK-NEXT: 1,
5151
# CHECK-NEXT: 0,
52-
# CHECK-NEXT: 16387
52+
# CHECK-NEXT: 32771
5353
# CHECK-NEXT: ],
5454
# Inserted at position 1
5555
# CHECK-NEXT: "deleteCount": 0,
@@ -72,12 +72,12 @@
7272
# CHECK-NEXT: 4,
7373
# CHECK-NEXT: 1,
7474
# CHECK-NEXT: 0,
75-
# CHECK-NEXT: 16387,
75+
# CHECK-NEXT: 32771,
7676
# CHECK-NEXT: 1,
7777
# CHECK-NEXT: 4,
7878
# CHECK-NEXT: 1,
7979
# CHECK-NEXT: 0,
80-
# CHECK-NEXT: 16387
80+
# CHECK-NEXT: 32771
8181
# CHECK-NEXT: ],
8282
# CHECK-NEXT: "resultId": "3"
8383
# CHECK-NEXT: }

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ TEST(SemanticHighlighting, GetsCorrectTokens) {
142142
$Namespace[[abc]]::$Class[[A]]<int> $Variable_def[[AA]];
143143
typedef $Namespace[[abc]]::$Class[[A]]<int> $Class_decl[[AAA]];
144144
struct $Class_def[[B]] {
145-
$Class_decl[[B]]();
146-
~$Class[[B]](); // FIXME: inconsistent with constructor
145+
$Class_decl_constrDestr[[B]]();
146+
~$Class_decl_constrDestr[[B]]();
147147
void operator<<($Class[[B]]);
148148
$Class[[AAA]] $Field_decl[[AA]];
149149
};
150-
$Class[[B]]::$Class_def[[B]]() {}
151-
$Class[[B]]::~$Class[[B]]() {} // FIXME: inconsistent with constructor
150+
$Class[[B]]::$Class_def_constrDestr[[B]]() {}
151+
$Class[[B]]::~$Class_def_constrDestr[[B]]() {}
152152
void $Function_def[[f]] () {
153153
$Class[[B]] $LocalVariable_def[[BB]] = $Class[[B]]();
154-
$LocalVariable[[BB]].~$Class[[B]]();
154+
$LocalVariable[[BB]].~$Class_constrDestr[[B]]();
155155
$Class[[B]]();
156156
}
157157
)cpp",
@@ -310,13 +310,13 @@ TEST(SemanticHighlighting, GetsCorrectTokens) {
310310
$Class[[Foo]] $Field_decl[[Fo]];
311311
$Enum[[En]] $Field_decl[[E]];
312312
int $Field_decl[[I]];
313-
$Class_def[[Bar]] ($Class[[Foo]] $Parameter_def[[F]],
313+
$Class_def_constrDestr[[Bar]] ($Class[[Foo]] $Parameter_def[[F]],
314314
$Enum[[En]] $Parameter_def[[E]])
315315
: $Field[[Fo]] ($Parameter[[F]]), $Field[[E]] ($Parameter[[E]]),
316316
$Field[[I]] (123) {}
317317
};
318318
class $Class_def[[Bar2]] : public $Class[[Bar]] {
319-
$Class_def[[Bar2]]() : $Class[[Bar]]($Class[[Foo]](), $EnumConstant_readonly[[EC]]) {}
319+
$Class_def_constrDestr[[Bar2]]() : $Class[[Bar]]($Class[[Foo]](), $EnumConstant_readonly[[EC]]) {}
320320
};
321321
)cpp",
322322
R"cpp(
@@ -757,7 +757,7 @@ sizeof...($TemplateParameter[[Elements]]);
757757
static inline int $StaticField_def_static[[j]] = 0;
758758
};
759759
struct $Class_def[[ClassWithRefMembers]] {
760-
$Class_def[[ClassWithRefMembers]](int $Parameter_def[[i]])
760+
$Class_def_constrDestr[[ClassWithRefMembers]](int $Parameter_def[[i]])
761761
: $Field[[i1]]($Parameter[[i]]),
762762
$Field_readonly[[i2]]($Parameter[[i]]),
763763
$Field[[i3]]($Parameter_usedAsMutableReference[[i]]),
@@ -803,7 +803,7 @@ sizeof...($TemplateParameter[[Elements]]);
803803
$LocalVariable_readonly[[c2]][$LocalVariable[[val]]];
804804
}
805805
struct $Class_def[[S]] {
806-
$Class_def[[S]](int&) {
806+
$Class_def_constrDestr[[S]](int&) {
807807
$Class[[S]] $LocalVariable_def[[s1]]($Field_usedAsMutableReference[[field]]);
808808
$Class[[S]] $LocalVariable_def[[s2]]($LocalVariable[[s1]].$Field_usedAsMutableReference[[field]]);
809809

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ Changes in existing checks
158158
The check now skips unions/union-like classes since in this case a default constructor
159159
with empty body is not equivalent to the explicitly defaulted one, variadic constructors
160160
since they cannot be explicitly defaulted. The check also skips copy assignment operators
161-
with nonstandard return types. The check is restricted to c++11-or-later.
161+
with nonstandard return types, private/protected default constructors for C++17 or earlier.
162+
The check is restricted to C++11 or later.
162163

163164
- Change the default behavior of :doc:`readability-avoid-const-params-in-decls
164165
<clang-tidy/checks/readability/avoid-const-params-in-decls>` to not

clang-tools-extra/docs/clang-tidy/checks/google/readability-avoid-underscore-in-googletest-name.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ still checked.
3030

3131
This check does not propose any fixes.
3232

33-
.. _Underscores are not allowed: https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
34-
.. _disable individual tests: https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
33+
.. _Underscores are not allowed: https://google.github.io/googletest/faq.html#why-should-test-suite-names-and-test-names-not-contain-underscore
34+
.. _disable individual tests: https://google.github.io/googletest/advanced.html#temporarily-disabling-tests

0 commit comments

Comments
 (0)