Skip to content

Commit d534a9b

Browse files
authored
Merge branch 'main' into amdgcnspirv_does_not_need_passes
2 parents cb678c7 + dacabc1 commit d534a9b

File tree

508 files changed

+17070
-6298
lines changed

Some content is hidden

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

508 files changed

+17070
-6298
lines changed

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

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4532,6 +4532,139 @@ TEST(CompletionTest, MemberAccessInExplicitObjMemfn) {
45324532
EXPECT_THAT(Result.Completions, ElementsAre());
45334533
}
45344534
}
4535+
4536+
TEST(CompletionTest, ListExplicitObjectOverloads) {
4537+
Annotations Code(R"cpp(
4538+
struct S {
4539+
void foo1(int a);
4540+
void foo2(int a) const;
4541+
void foo2(this const S& self, float a);
4542+
void foo3(this const S& self, int a);
4543+
void foo4(this S& self, int a);
4544+
};
4545+
4546+
void S::foo1(int a) {
4547+
this->$c1^;
4548+
}
4549+
4550+
void S::foo2(int a) const {
4551+
this->$c2^;
4552+
}
4553+
4554+
void S::foo3(this const S& self, int a) {
4555+
self.$c3^;
4556+
}
4557+
4558+
void S::foo4(this S& self, int a) {
4559+
self.$c4^;
4560+
}
4561+
4562+
void test1(S s) {
4563+
s.$c5^;
4564+
}
4565+
4566+
void test2(const S s) {
4567+
s.$c6^;
4568+
}
4569+
)cpp");
4570+
4571+
auto TU = TestTU::withCode(Code.code());
4572+
TU.ExtraArgs = {"-std=c++23"};
4573+
4574+
auto Preamble = TU.preamble();
4575+
ASSERT_TRUE(Preamble);
4576+
4577+
CodeCompleteOptions Opts{};
4578+
4579+
MockFS FS;
4580+
auto Inputs = TU.inputs(FS);
4581+
4582+
{
4583+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c1"),
4584+
Preamble.get(), Inputs, Opts);
4585+
EXPECT_THAT(
4586+
Result.Completions,
4587+
UnorderedElementsAre(AllOf(named("foo1"), signature("(int a)"),
4588+
snippetSuffix("(${1:int a})")),
4589+
AllOf(named("foo2"), signature("(int a) const"),
4590+
snippetSuffix("(${1:int a})")),
4591+
AllOf(named("foo2"), signature("(float a) const"),
4592+
snippetSuffix("(${1:float a})")),
4593+
AllOf(named("foo3"), signature("(int a) const"),
4594+
snippetSuffix("(${1:int a})")),
4595+
AllOf(named("foo4"), signature("(int a)"),
4596+
snippetSuffix("(${1:int a})"))));
4597+
}
4598+
{
4599+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c2"),
4600+
Preamble.get(), Inputs, Opts);
4601+
EXPECT_THAT(
4602+
Result.Completions,
4603+
UnorderedElementsAre(AllOf(named("foo2"), signature("(int a) const"),
4604+
snippetSuffix("(${1:int a})")),
4605+
AllOf(named("foo2"), signature("(float a) const"),
4606+
snippetSuffix("(${1:float a})")),
4607+
AllOf(named("foo3"), signature("(int a) const"),
4608+
snippetSuffix("(${1:int a})"))));
4609+
}
4610+
{
4611+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c3"),
4612+
Preamble.get(), Inputs, Opts);
4613+
EXPECT_THAT(
4614+
Result.Completions,
4615+
UnorderedElementsAre(AllOf(named("foo2"), signature("(int a) const"),
4616+
snippetSuffix("(${1:int a})")),
4617+
AllOf(named("foo2"), signature("(float a) const"),
4618+
snippetSuffix("(${1:float a})")),
4619+
AllOf(named("foo3"), signature("(int a) const"),
4620+
snippetSuffix("(${1:int a})"))));
4621+
}
4622+
{
4623+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c4"),
4624+
Preamble.get(), Inputs, Opts);
4625+
EXPECT_THAT(
4626+
Result.Completions,
4627+
UnorderedElementsAre(AllOf(named("foo1"), signature("(int a)"),
4628+
snippetSuffix("(${1:int a})")),
4629+
AllOf(named("foo2"), signature("(int a) const"),
4630+
snippetSuffix("(${1:int a})")),
4631+
AllOf(named("foo2"), signature("(float a) const"),
4632+
snippetSuffix("(${1:float a})")),
4633+
AllOf(named("foo3"), signature("(int a) const"),
4634+
snippetSuffix("(${1:int a})")),
4635+
AllOf(named("foo4"), signature("(int a)"),
4636+
snippetSuffix("(${1:int a})"))));
4637+
}
4638+
{
4639+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c5"),
4640+
Preamble.get(), Inputs, Opts);
4641+
EXPECT_THAT(
4642+
Result.Completions,
4643+
UnorderedElementsAre(AllOf(named("foo1"), signature("(int a)"),
4644+
snippetSuffix("(${1:int a})")),
4645+
AllOf(named("foo2"), signature("(int a) const"),
4646+
snippetSuffix("(${1:int a})")),
4647+
AllOf(named("foo2"), signature("(float a) const"),
4648+
snippetSuffix("(${1:float a})")),
4649+
AllOf(named("foo3"), signature("(int a) const"),
4650+
snippetSuffix("(${1:int a})")),
4651+
AllOf(named("foo4"), signature("(int a)"),
4652+
snippetSuffix("(${1:int a})"))));
4653+
}
4654+
{
4655+
auto Result = codeComplete(testPath(TU.Filename), Code.point("c6"),
4656+
Preamble.get(), Inputs, Opts);
4657+
EXPECT_THAT(
4658+
Result.Completions,
4659+
UnorderedElementsAre(AllOf(named("foo2"), signature("(int a) const"),
4660+
snippetSuffix("(${1:int a})")),
4661+
AllOf(named("foo2"), signature("(float a) const"),
4662+
snippetSuffix("(${1:float a})")),
4663+
AllOf(named("foo3"), signature("(int a) const"),
4664+
snippetSuffix("(${1:int a})"))));
4665+
}
4666+
}
4667+
45354668
} // namespace
45364669
} // namespace clangd
45374670
} // namespace clang

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,7 @@ Hexadecimal floating constants (N308) C
17631763
Compound literals (N716) C99 C89, C++
17641764
``//`` comments (N644) C99 C89
17651765
Mixed declarations and code (N740) C99 C89
1766+
init-statement in for (N740) C99 C89
17661767
Variadic macros (N707) C99 C89
17671768
Empty macro arguments (N570) C99 C89
17681769
Trailing comma in enum declaration C99 C89

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ Improvements to Clang's diagnostics
209209
potential misaligned members get processed before they can get discarded.
210210
(#GH144729)
211211

212+
- Fixed false positive in ``-Wmissing-noreturn`` diagnostic when it was requiring the usage of
213+
``[[noreturn]]`` on lambdas before C++23 (#GH154493).
214+
212215
Improvements to Clang's time-trace
213216
----------------------------------
214217

0 commit comments

Comments
 (0)