summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/complete-exprs.c
Commit message (Collapse)AuthorAgeFilesLines
* This reverts commit 632a36bfcfc8273c1861f04ff6758d863c47c784.Sylvestre Ledru2019-07-131-0/+2
| | | | | | | | | | | | Some targets such as Python 2.7.16 still use VERSION in their builds. Without VERSION defined, the source code has syntax errors. Reverting as it will probably break many other things. Noticed by Sterling Augustine llvm-svn: 365992
* Remove __VERSION__Sylvestre Ledru2019-07-121-2/+0
| | | | | | | | | | | | | | | | | | | | Summary: It has been introduced in 2011 for gcc compat: https://github.com/llvm-mirror/clang/commit/ad1a4c6e89594e704775ddb6b036ac982fd68cad it is probably time to remove it Reviewers: rnk, dexonsmith Reviewed By: rnk Subscribers: dschuff, aheejin, fedor.sergeev, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64062 llvm-svn: 365962
* [CodeComplete] Fill preferred type on binary expressionsIlya Biryukov2018-12-131-9/+4
| | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55648 llvm-svn: 349053
* [CodeComplete] Fix completion at the end of keywordsIlya Biryukov2018-04-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make completion behave consistently no matter if it is run at the start, in the middle or at the end of an identifier that happens to be a keyword or a macro name. Since completion is often ran on incomplete identifiers, they may turn into keywords by accident. For example, we should produce same results for all of these completion points: // ^ is completion point. ^class cla^ss class^ Previously clang produced different results for the last case (as if the completion point was after a space: `class ^`). This change also updates some offsets in tests that (unintentionally?) relied on the old behavior. Reviewers: sammccall, bkramer, arphaman, aaron.ballman Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45887 llvm-svn: 330717
* When code completing in a statement, parenthesized expression, orDouglas Gregor2013-01-311-1/+1
| | | | | | | | Objective-C message receiver, the user is as likely to want to write a type name as any other declaration, so give types the same priority as other declarations. Fixes <rdar://problem/12480600>. llvm-svn: 174038
* Provide result types for code completions that describe built-inDouglas Gregor2011-10-181-3/+3
| | | | | | expressions (this, sizeof, etc.). llvm-svn: 142424
* Tweak code-completion result priorities, so that exact and similarDouglas Gregor2010-10-191-6/+6
| | | | | | | | | type matches have a bigger impact. The impetus for this change was that, when initializing an enumeration value, we want enumerators of that enumeration type to have a higher priority than, e.g., unrelated local variables. llvm-svn: 116774
* Add code completion for C++ constructors wherever we see the class (orDouglas Gregor2010-09-211-3/+3
| | | | | | class template) and are in a context where we can have a value. llvm-svn: 114441
* Code completion has no reason to prefer values over types, especiallyDouglas Gregor2010-09-201-3/+3
| | | | | | | | at the statement level or in Objective-C message receivers. Therefore, just give types and declarations the same basic priority, and adjust from there. llvm-svn: 114374
* Get rid of the lame attempt to prioritize "void" functions atDouglas Gregor2010-09-201-1/+1
| | | | | | | statement context; it really isn't helpful in practice (remember printf!) and we'll be doing other adjustments for statements very soon. llvm-svn: 114358
* Swap the priorities of constants and types, so that we prefer types.Douglas Gregor2010-09-161-5/+5
| | | | llvm-svn: 114086
* Introduce a new code-completion context for a parenthesizedDouglas Gregor2010-09-141-0/+16
| | | | | | | | expression, e.g., after the '(' that could also be a type cast. Here, we provide types as code-completion results in C/Objective-C (C++ already had them), although we wouldn't in a normal expression context. llvm-svn: 113904
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* When provide code completions for a variadic Objective-C methodDouglas Gregor2010-08-311-1/+1
| | | | | | | | declaration send or a variadic function call, collapse the ", ..." into the parameter before it, so that we don't get a second placeholder. llvm-svn: 112579
* When combining the code-completion results from Sema long with theDouglas Gregor2010-08-251-6/+1
| | | | | | | | code-completion results cached by ASTUnit, sort the resulting result set. This makes testing far, far easier, so this commit also includes tests for the previous few fixes. llvm-svn: 112070
* Introduce a preprocessor code-completion hook for contexts where weDouglas Gregor2010-08-251-4/+0
| | | | | | | expect "natural" language and should not provide any completions, e.g., comments, string literals, #error. llvm-svn: 112054
* Give a slight preference to functions returning "void" when we'reDouglas Gregor2010-08-241-1/+1
| | | | | | | performing code completion at the statement level (rather than in an arbitrary expression). llvm-svn: 112001
* In code-completion contexts where both types and other values areDouglas Gregor2010-08-241-7/+7
| | | | | | | | | present, prefer values to types, since it's more common to compute with values than it is to declare new entities or perform type casts. So, tweak the ranking of types vs. other declarations and constants accordingly. llvm-svn: 111998
* When calling a function or messaging a method marked "sentinel", addDouglas Gregor2010-08-231-0/+11
| | | | | | | the ", nil", ", NULL", or ", (void*)0" to the end of the code completion, since it always has to be there anyway. llvm-svn: 111867
* Introduce new libclang API functions that determine the availabilityDouglas Gregor2010-08-231-4/+4
| | | | | | | of a cursor or code-completion result, e.g., whether that result refers to an unavailable, deleted, or deprecated declaration. llvm-svn: 111858
* Include __FUNCTION__, __PRETTY_FUNCTION_, __func__ in code-completionDouglas Gregor2010-08-231-0/+2
| | | | | | results for expression contexts within a function. llvm-svn: 111851
* When caching code completions for global declarations, keep track ofDouglas Gregor2010-08-161-2/+1
| | | | | | | | | | | | | | | | the usage type of each declaration result, then compare those types to the preferred type of the completion. This provides parity in the priority calculation between the code-completion results produced directly from Sema and those cached by ASTUnit. For the standard Cocoa.h (+ others) example, there's a penalty of 3-4 hundredeths of a second when caching the global results (for ~31,000 results), because we need an ASTContext-agnostic representation of types for the comparison, and therefore we use... strings. Eventually, we'd like to implement a more efficient ASTContext-agnostic encoding of types. llvm-svn: 111165
* When caching global completion results, keep track of the simplifiedDouglas Gregor2010-08-161-1/+1
| | | | | | | | | | | type class, so that we can adjust priorities appropriately when the preferred type for the context and the actual type of the completion are similar. This gets us one step closer to parity of the cached completion results with the non-cached completion results. llvm-svn: 111139
* Extend the code-completion caching infrastructure to include globalDouglas Gregor2010-08-151-0/+6
| | | | | | | | | | | | | | | | | | declarations (in addition to macros). Each kind of declaration maps to a certain set of completion contexts, and the ASTUnit completion logic introduces the completion strings for those declarations if the actual code-completion occurs in one of the contexts where it matters. There are a few new code-completion-context kinds. Without these, certain completions (e.g., after "using namespace") would need to suppress all global completions, which would be unfortunate. Note that we don't get the priorities right for global completions, because we don't have enough type information. We'll need a way to compare types in an ASTContext-agnostic way before this can be implemented. llvm-svn: 111093
* Add code-completion support directly to ASTUnit, which performs codeDouglas Gregor2010-08-041-0/+2
| | | | | | | | | | | | | | completion within the translation unit using the same command-line arguments for parsing the translation unit. Eventually, we'll reuse the precompiled preamble to improve code-completion performance, and this also gives us a place to cache results. Expose this function via the new libclang function clang_codeCompleteAt(), which performs the code completion within a CXTranslationUnit. The completion occurs in-process (clang_codeCompletion() runs code completion out-of-process). llvm-svn: 110210
* Improve our handling of NULL after an escaping '\' in a stringDouglas Gregor2010-05-301-0/+5
| | | | | | literal. Fixes <rdar://problem/8044135>. llvm-svn: 105181
* Improve parser recovery when we try to parse a call expression but theDouglas Gregor2010-05-301-0/+7
| | | | | | | called function itself is invalid (e.g., because of a semantic error referring to that declaration). Fixes <rdar://problem/8044142>. llvm-svn: 105175
* Teach code completion to adjust its completion priorities based on theDouglas Gregor2010-05-301-5/+11
| | | | | | | | | type that we expect to see at a given point in the grammar, e.g., when initializing a variable, returning a result, or calling a function. We don't prune the candidate set at all, just adjust priorities to favor things that should type-check, using an ultra-simplified type system. llvm-svn: 105128
* Do not produce types as valid code completions when we're in anDouglas Gregor2010-05-281-1/+7
| | | | | | | expression context in C/Objective-C, or when we're in an @interface/@implementation/@protocol in Objective-C(++). llvm-svn: 104908
* Introduce priorities into the code-completion results.Douglas Gregor2010-05-261-2/+5
| | | | llvm-svn: 104751
* Only enable code patterns (e.g., try { statements } catch (...) {Douglas Gregor2010-05-251-4/+4
| | | | | | statements }) in the code-completion results if explicitly requested. llvm-svn: 104637
* Perform code-completion within ParseCastExpression, which handles,Douglas Gregor2010-04-061-0/+15
e.g., the right-hand side of binary expressions. llvm-svn: 100526
OpenPOWER on IntegriCloud