aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaCodeComplete.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-11-15[Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo ↵Craig Topper1-3/+3
on the AST context instead of Preprocessor. NFC llvm-svn: 253175
2015-11-15[libclang] Visit TypeAliasTemplateDeclSergey Kalinichev1-0/+1
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings Differential Revision: http://reviews.llvm.org/D13844 llvm-svn: 253166
2015-10-22Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall1-1/+1
Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
2015-07-24[code-completion] Strip outer nullability annotations when completing method ↵Argyrios Kyrtzidis1-3/+6
implementations. The outer nullability is transferred from the declaration to the implementation so including them is redundant. The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well adding them in the implementation will become redundant and we should strip those as well. rdar://21737451 llvm-svn: 243119
2015-07-09[CodeCompletion] Don't crash on member inits of templated constructors.Benjamin Kramer1-3/+7
Also fixes a crash (on invalid) member functions with a colon initializer. PR23948. llvm-svn: 241811
2015-07-07[libclang] Replace ObjC generic parameters when code-completing method ↵Douglas Gregor1-1/+4
implementations. rdar://20643768 llvm-svn: 241559
2015-07-07[libclang] Fix code-completion of block parameters that are marked with ↵Douglas Gregor1-0/+5
nullability specifier. rdar://20755276 llvm-svn: 241558
2015-07-07[libclang] Replace ObjC generic parameters in code-completion results.Douglas Gregor1-38/+75
rdar://19369529 llvm-svn: 241557
2015-07-07Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor1-1/+3
Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
2015-06-24Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor1-3/+3
_Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-2/+2
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-2/+2
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-19Code completion for nullability type specifiers.Douglas Gregor1-13/+58
Another part of rdar://problem/18868820. llvm-svn: 240159
2015-05-29Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer1-3/+1
If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
2015-04-29[modules] Stop trying to fake up a linear MacroDirective history.Richard Smith1-28/+21
Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
2015-04-23[modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith1-1/+1
that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
2015-03-13[libclang] Fix crash when code-completing inside constructor initializer for ↵Argyrios Kyrtzidis1-1/+7
a builtin type. rdar://20149746 llvm-svn: 232145
2015-02-21Cleanup: remove artificial division between lookup results and const lookupRichard Smith1-2/+2
results. No-one was ever modifying a lookup result, and it would not be reasonable to do so. llvm-svn: 230123
2015-01-29Sema: Turn some applicable functions static. NBC.Francisco Lopes da Silva1-9/+10
llvm-svn: 227418
2015-01-28Improves overload completion result chunks.Francisco Lopes da Silva1-48/+89
The code building the code completion string for overloads was providing less detail compared to the one building completion strings for function declarations. There was no information about optionals and no information about what's a parameter and what's a function identifier, everything besides ResultType, CurrentParameter and special characters was classified as Text. This makes code completion strings for overload candidates to follow a pattern very similar, but not identical, to the one in use for function declarations: - return type chunk: ResultType - function identifier chunk: Text - parameter chunks: Placeholder - optional parameter chunks: Optional - current parameter chunk: CurrentParameter llvm-svn: 227309
2015-01-25Sema: Formatting. No behavior change.Francisco Lopes da Silva1-1/+1
llvm-svn: 227052
2015-01-25Sema: require a complete type before lookup.Francisco Lopes da Silva1-11/+14
llvm-svn: 227037
2015-01-23Sema: code completion for variadic prototypes.Francisco Lopes da Silva1-1/+3
llvm-svn: 226908
2015-01-22Sema: code completion for pointer and reference to functions.Francisco Lopes da Silva1-19/+29
llvm-svn: 226865
2015-01-22Sema: Add FIXME noteFrancisco Lopes da Silva1-0/+1
llvm-svn: 226813
2015-01-21Initial support for C++ parameter completionFrancisco Lopes da Silva1-76/+150
The improved completion in call context now works with: - Functions. - Member functions. - Constructors. - New expressions. - Function call expressions. - Template variants of the previous. There are still rough edges to be fixed: - Provide support for optional parameters. (fix known) - Provide support for member initializers. (fix known) - Provide support for variadic template functions. (fix unknown) - Others? llvm-svn: 226670
2015-01-15PR13699: Include friend declarations in code completion results if they had aRichard Smith1-3/+6
prior visible declaration. Prefer to take template parameter names from the first declaration. Testcase from a patch by Francisco Lopes! llvm-svn: 226083
2014-12-27Address review feedback on r221933.Nico Weber1-15/+17
Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in the low bit of the ObjCMethodDecl pointer, using a PointerIntPair. Most of this patch is replacing ".Method" with ".getMethod()". No intended behavior change. llvm-svn: 224876
2014-11-19Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie1-34/+42
pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
2014-11-14Typo fix.Yaron Keren1-1/+1
llvm-svn: 222016
2014-09-30Avoid a crash after loading an #undef'd macro in code completionBen Langmuir1-1/+2
In code-completion, don't assume there is a MacroInfo for everything, since we aren't serializing the def corresponding to a later #undef in the same module. Also setup the HadMacro bit correctly for undefs to avoid an assertion failure. rdar://18416901 llvm-svn: 218694
2014-07-07Switch over a few uses of param_begin() to parameters()Alp Toker1-2/+2
llvm-svn: 212442
2014-06-30Extract an isReservedName() functionAlp Toker1-18/+18
We'll want to share the implementation if anything else decides to check for reserved names in future, so make this little snippet of code more discoverable. Also remove the __va_list_tag and __builtin_va_list special-case checks. They're leftovers from before when the reserved name logic was added. No change in functionality. llvm-svn: 212006
2014-05-29Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic1-3/+3
takeAs to getAs. llvm-svn: 209800
2014-05-26[C++11] Use 'nullptr'. Sema edition.Craig Topper1-88/+95
llvm-svn: 209613
2014-05-10Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer1-5/+3
Required pulling LambdaExpr::Capture into its own header. No functionality change. llvm-svn: 208470
2014-04-17Implement [over.match.oper]p3 properly, by filtering the non-candidates outRichard Smith1-1/+1
when building the candidate set, rather than trying to contort name lookup into handling this. llvm-svn: 206436
2014-04-09[Preprocessor/CodeComplete] Don't add include guard macros to ↵Argyrios Kyrtzidis1-1/+6
code-completion results. llvm-svn: 205917
2014-03-17[C++11] Replacing Scope iterators decl_begin() and decl_end() with ↵Aaron Ballman1-3/+2
iterator_range decls(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. llvm-svn: 204052
2014-03-17[C++11] Replacing ObjCObjectPointerType iterators qual_begin() and ↵Aaron Ballman1-12/+6
qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204048
2014-03-14[C++11] Replacing ObjCCategoryDecl iterators protocol_begin() and ↵Aaron Ballman1-4/+2
protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203922
2014-03-13[C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and ↵Aaron Ballman1-4/+2
protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203863
2014-03-13[C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and ↵Aaron Ballman1-17/+6
known_categories_end() with iterator_range known_categories(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203854
2014-03-13[C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and ↵Aaron Ballman1-23/+8
visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203851
2014-03-13[C++11] Replacing ObjCInterfaceDecl iterators ↵Aaron Ballman1-4/+2
all_referenced_protocol_begin() and all_referenced_protocol_end() with iterator_range all_referenced_protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203848
2014-03-13[C++11] Replacing ObjCInterfaceDecl iterators protocol_begin() and ↵Aaron Ballman1-4/+2
protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. Drive-by fixing some incorrect types where a for loop would be improperly using ObjCInterfaceDecl::protocol_iterator. No functional changes in these cases. llvm-svn: 203842
2014-03-13Renaming the recently-created (r203830) props() range API to properties() ↵Aaron Ballman1-2/+2
for clarity. llvm-svn: 203835
2014-03-13[C++11] Replacing ObjCContainerDecl iterators meth_begin() and meth_end() ↵Aaron Ballman1-14/+8
with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203832
2014-03-13[C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() ↵Aaron Ballman1-13/+5
with iterator_range props(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203830
2014-03-13[C++11] Replacing CXXRecordDecl iterators vbases_begin() and vbases_end() ↵Aaron Ballman1-6/+4
with iterator_range vbases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203808