summaryrefslogtreecommitdiff
path: root/clang/test/CodeCompletion/function-templates.cpp
AgeCommit message (Collapse)Author
2022-12-19[lit] Script to automate use of %(line-n). Use in CodeComplete tests.Sam McCall
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
2019-11-22[clangd] Show lambda signature for lambda autocompletionsKirill Bobyrev
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 &b) {return 1.f;}; La^ } ``` Triggering the completion at `^` would show `(lambda)` before this patch and would show signature `(int a, double &b) const`, build a snippet etc with this patch. Reviewers: sammccall Reviewed by: sammccall Differential revision: https://reviews.llvm.org/D70445
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar
- 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
2009-12-11Member function templates can occur after . or ->Douglas Gregor
llvm-svn: 91137
2009-11-08Remove RUN: true lines.Daniel Dunbar
llvm-svn: 86432
2009-11-08Eliminate &&s in tests.Daniel Dunbar
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
2009-09-22Replace the -code-completion-dump option with Douglas Gregor
-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
2009-09-18Make the construction of the code-completion string for a functionDouglas Gregor
template smarter, by taking into account which function template parameters are deducible from the call arguments. For example, template<typename RandomAccessIterator> 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<class X, class Y> X* dyn_cast(Y *Val); will have a code-completion string like dyn_cast<{class X}>({Y *Val}) since the template type parameter X is not deducible from the function call. llvm-svn: 82306