<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/test/CodeCompletion/function-templates.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[lit] Script to automate use of %(line-n). Use in CodeComplete tests.</title>
<updated>2022-12-19T13:19:21+00:00</updated>
<author>
<name>Sam McCall</name>
<email>sam.mccall@gmail.com</email>
</author>
<published>2022-12-16T14:59:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cf9b25e0adc42546e4dc5ff51ee8674d45bac26b'/>
<id>cf9b25e0adc42546e4dc5ff51ee8674d45bac26b</id>
<content type='text'>
Tests where the RUN-lines/CHECK-ed output refer to line numbers in the test
file are a maintenance burden, as inserting text in the appropriate place
invalidates all the subsequent line numbers.

Lit supports %(line+n) for this, and FileCheck supports [[@LINE+N]].
But many existing tests don't make use of it and still need to be modified.

This commit adds a script that can find line numbers in tests according to a
regex and replace them with the appropriate relative-line reference.
It contains some options to avoid inappropriately rewriting tests where absolute
numbers are appropriate: a "nearby" threshold and a refusal by default to
replace only some matched line numbers.

I've applied it to CodeComplete tests, this proves the concept but also are the
single worst group of tests I've seen in this respect.
These changes are likely to hit merge conflicts, but can be regenerated with:

```
find ../clang/test/CodeCompletion/ -type f | grep -v /Inputs/ | xargs ../llvm/utils/relative_lines.py --verbose --near=20 --pattern='-code-completion-at[ =]%s:(\\d+):' --pattern='requires fix-it: {(\d+):\d+-(\d+):\d+}'
````

As requested in https://reviews.llvm.org/D140044

Fixes https://github.com/llvm/llvm-project/issues/59553

Differential Revision: https://reviews.llvm.org/D140217
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tests where the RUN-lines/CHECK-ed output refer to line numbers in the test
file are a maintenance burden, as inserting text in the appropriate place
invalidates all the subsequent line numbers.

Lit supports %(line+n) for this, and FileCheck supports [[@LINE+N]].
But many existing tests don't make use of it and still need to be modified.

This commit adds a script that can find line numbers in tests according to a
regex and replace them with the appropriate relative-line reference.
It contains some options to avoid inappropriately rewriting tests where absolute
numbers are appropriate: a "nearby" threshold and a refusal by default to
replace only some matched line numbers.

I've applied it to CodeComplete tests, this proves the concept but also are the
single worst group of tests I've seen in this respect.
These changes are likely to hit merge conflicts, but can be regenerated with:

```
find ../clang/test/CodeCompletion/ -type f | grep -v /Inputs/ | xargs ../llvm/utils/relative_lines.py --verbose --near=20 --pattern='-code-completion-at[ =]%s:(\\d+):' --pattern='requires fix-it: {(\d+):\d+-(\d+):\d+}'
````

As requested in https://reviews.llvm.org/D140044

Fixes https://github.com/llvm/llvm-project/issues/59553

Differential Revision: https://reviews.llvm.org/D140217
</pre>
</div>
</content>
</entry>
<entry>
<title>[clangd] Show lambda signature for lambda autocompletions</title>
<updated>2019-11-22T11:48:06+00:00</updated>
<author>
<name>Kirill Bobyrev</name>
<email>kbobyrev@google.com</email>
</author>
<published>2019-11-22T11:48:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7f0dcf665dd22be296805bc7a1c71a36243c4e09'/>
<id>7f0dcf665dd22be296805bc7a1c71a36243c4e09</id>
<content type='text'>
The original bug report can be found
[here](https://github.com/clangd/clangd/issues/85)

Given the following code:

```c++
void function() {
  auto Lambda = [](int a, double &amp;b) {return 1.f;};
  La^
}
```

Triggering the completion at `^` would show `(lambda)` before this patch
and would show signature `(int a, double &amp;b) const`, build a snippet etc
with this patch.

Reviewers: sammccall

Reviewed by: sammccall

Differential revision: https://reviews.llvm.org/D70445
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The original bug report can be found
[here](https://github.com/clangd/clangd/issues/85)

Given the following code:

```c++
void function() {
  auto Lambda = [](int a, double &amp;b) {return 1.f;};
  La^
}
```

Triggering the completion at `^` would show `(lambda)` before this patch
and would show signature `(int a, double &amp;b) const`, build a snippet etc
with this patch.

Reviewers: sammccall

Reviewed by: sammccall

Differential revision: https://reviews.llvm.org/D70445
</pre>
</div>
</content>
</entry>
<entry>
<title>Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.</title>
<updated>2009-12-15T20:14:24+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2009-12-15T20:14:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8fbe78f6fc7b41d1a4228c126fcb522131150518'/>
<id>8fbe78f6fc7b41d1a4228c126fcb522131150518</id>
<content type='text'>
 - This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 - This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
</pre>
</div>
</content>
</entry>
<entry>
<title>Member function templates can occur after . or -&gt;</title>
<updated>2009-12-11T18:14:22+00:00</updated>
<author>
<name>Douglas Gregor</name>
<email>dgregor@apple.com</email>
</author>
<published>2009-12-11T18:14:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7078839b0ef25ab0d8a3c59113b292463ef2afd4'/>
<id>7078839b0ef25ab0d8a3c59113b292463ef2afd4</id>
<content type='text'>
llvm-svn: 91137
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 91137
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove RUN: true lines.</title>
<updated>2009-11-08T01:47:25+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2009-11-08T01:47:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=34546ce43d3d89c102a99882ae3825423a28abcd'/>
<id>34546ce43d3d89c102a99882ae3825423a28abcd</id>
<content type='text'>
llvm-svn: 86432
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 86432
</pre>
</div>
</content>
</entry>
<entry>
<title>Eliminate &amp;&amp;s in tests.</title>
<updated>2009-11-08T01:45:36+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2009-11-08T01:45:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8b576979549184e73c6876ec4b494aacf7c87d2d'/>
<id>8b576979549184e73c6876ec4b494aacf7c87d2d</id>
<content type='text'>
 - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&amp;&amp; *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&amp;&amp; *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace the -code-completion-dump option with </title>
<updated>2009-09-22T21:11:38+00:00</updated>
<author>
<name>Douglas Gregor</name>
<email>dgregor@apple.com</email>
</author>
<published>2009-09-22T21:11:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ea9b03e6e23408325145ca089e4d7d6386b65a2d'/>
<id>ea9b03e6e23408325145ca089e4d7d6386b65a2d</id>
<content type='text'>
  -code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.

llvm-svn: 82571
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  -code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.

llvm-svn: 82571
</pre>
</div>
</content>
</entry>
<entry>
<title>Make the construction of the code-completion string for a function</title>
<updated>2009-09-18T23:21:38+00:00</updated>
<author>
<name>Douglas Gregor</name>
<email>dgregor@apple.com</email>
</author>
<published>2009-09-18T23:21:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ce23bae4f82a4d2999f8bd502d8277fc3d0db8da'/>
<id>ce23bae4f82a4d2999f8bd502d8277fc3d0db8da</id>
<content type='text'>
template smarter, by taking into account which function template
parameters are deducible from the call arguments. For example,

  template&lt;typename RandomAccessIterator&gt;
  void sort(RandomAccessIterator first, RandomAccessIterator last);

will have a code-completion string like

  sort({RandomAccessIterator first}, {RandomAccessIterator last})

since the template argument for its template parameter is
deducible. On the other hand,

  template&lt;class X, class Y&gt;
  X* dyn_cast(Y *Val);

will have a code-completion string like

  dyn_cast&lt;{class X}&gt;({Y *Val})

since the template type parameter X is not deducible from the function
call.

llvm-svn: 82306
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
template smarter, by taking into account which function template
parameters are deducible from the call arguments. For example,

  template&lt;typename RandomAccessIterator&gt;
  void sort(RandomAccessIterator first, RandomAccessIterator last);

will have a code-completion string like

  sort({RandomAccessIterator first}, {RandomAccessIterator last})

since the template argument for its template parameter is
deducible. On the other hand,

  template&lt;class X, class Y&gt;
  X* dyn_cast(Y *Val);

will have a code-completion string like

  dyn_cast&lt;{class X}&gt;({Y *Val})

since the template type parameter X is not deducible from the function
call.

llvm-svn: 82306
</pre>
</div>
</content>
</entry>
</feed>
