summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When we attempt to create a built-in that involves a library type weDouglas Gregor2011-01-031-5/+14
| | | | | | | | | don't have access to (e.g., fprintf, which needs the library type FILE), fail with a warning and forget about the builtin entirely. Previously, we would actually provide an error, which breaks autoconf's super-lame checks for fprintf, longjmp, etc. Fixes PR8316. llvm-svn: 122744
* Remove obsolete comments.Francois Pichet2011-01-021-7/+0
| | | | llvm-svn: 122686
* Restore r121752 without modification.John McCall2010-12-141-5/+6
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-6/+5
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-5/+6
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Don't walk the translation unit context to produce protocol names whenDouglas Gregor2010-12-091-2/+14
| | | | | | | | | | global code completions are disabled (e.g., because they are cached). Also, make sure that forward-declared protocols are visited when we look for all visible names within a declaration context. Previously, we would end up with duplicate completions for protocols. llvm-svn: 121416
* Do not change the size of LookupResult::Filter based on the NDEBUGDouglas Gregor2010-12-021-2/+0
| | | | | | macri; the extra bool fits into padding anyway. llvm-svn: 120708
* Such function decls,as objc's objc_msgSend, builtins in Fariborz Jahanian2010-11-301-6/+1
| | | | | | | | | a specific language. We are adding such language info. by extensing Builtins.def and via a language flag added to LIBBUILTIN/BUILTIN and check for that when deciding a name is builtin or not. Implements //rdar://8689273. llvm-svn: 120429
* Restore patch reversed in r118475. FixesFariborz Jahanian2010-11-091-0/+5
| | | | | | // rdar://8632525 llvm-svn: 118634
* Fix memory leak of IdentifierIterator object.Ted Kremenek2010-11-071-1/+1
| | | | llvm-svn: 118371
* Teach code completion to provide property results when the propertyDouglas Gregor2010-11-021-1/+19
| | | | | | can be used to automatically synthesize an ivar. llvm-svn: 118052
* When doing name lookup for members don't look into global/namespace scope.Argyrios Kyrtzidis2010-10-291-0/+4
| | | | | | Better performance and fixes rdar://8603569. llvm-svn: 117656
* Remove redundant testDouglas Gregor2010-10-271-1/+1
| | | | llvm-svn: 117446
* Teach typo correction not to return the same keyword that matches aDouglas Gregor2010-10-261-1/+20
| | | | | | | | typo. This can happen with context-sensitive keywords like "super", when typo correction didn't know that "super" wasn't permitted in this context. llvm-svn: 117372
* C++ [basic.scope.hiding] allows an ordinary name to hide a non-tagDouglas Gregor2010-10-231-2/+7
| | | | | | | name *in the same scope*, but not across scopes. Implement the highlighted condition. llvm-svn: 117212
* In the presence of using declarations, we can find the same classDouglas Gregor2010-10-221-30/+66
| | | | | | | | members in class subobjects of different types. So long as the underlying declaration sets are the same, and the declaration sets involve non-instance members, this is not an ambiguity. llvm-svn: 117163
* Fix handling of property and ivar lookup in typo correction; the twoDouglas Gregor2010-10-201-57/+65
| | | | | | | kinds of lookup into Objective-C classes were tangled together, a situation that was compounded by automatically synthesized ivars. llvm-svn: 116907
* Introduce a simple cache for unqualified typo corrections, so that weDouglas Gregor2010-10-201-26/+70
| | | | | | | | | | | don't repeatedly loop through identifiers, correcting the same typo'd identifier over and over again. We still bail out after 20 typo corrections, but this should help improve performance in the common case where we're typo-correcting because the user forgot to include a header. llvm-svn: 116901
* Eliminate another ordering dependency in typo correction. Re-enable typo.m, ↵Douglas Gregor2010-10-201-1/+4
| | | | | | which seems to be working properly. llvm-svn: 116894
* Provide an upper bound to the edit-distance algorithm when performingDouglas Gregor2010-10-191-1/+7
| | | | | | typo correction, to allow early exits. llvm-svn: 116868
* Improve the performance of typo correction, by using a simpleDouglas Gregor2010-10-191-0/+6
| | | | | | | | | | computation to compute the lower bound of the edit distance, so that we can avoid computing the edit distance for names that will clearly be rejected later. Since edit distance is such an expensive algorithm (M x N), this leads to a 7.5x speedup when correcting NSstring -> NSString in the presence of a Cocoa PCH. llvm-svn: 116849
* When performing typo correction, keep track of whether the last lookupDouglas Gregor2010-10-151-1/+37
| | | | | | | | | we did was an acceptable lookup. If it is, then we can re-use that lookup result. If it isn't, we have to perform the lookup again. This is almost surely the cause behind the mysterious typo.m failures on some builders; we were getting the wrong lookup results returned. llvm-svn: 116586
* When we're in the context of an Objective-C message send's receiver,Douglas Gregor2010-10-151-1/+13
| | | | | | | typo correction prefers "super" over other, equivalent completions. I believe this will fix the regression on the buildbot. llvm-svn: 116574
* When performing typo correction, look through the set of knownDouglas Gregor2010-10-141-5/+31
| | | | | | | | | | | | | | | | | | | | identifiers to determine good typo-correction candidates. Once we've identified those candidates, we perform name lookup on each of them and the consider the results. This optimization makes typo correction > 2x faster on a benchmark example using a single typo (NSstring) in a tiny file that includes Cocoa.h from a precompiled header, since we are deserializing far less information now during typo correction. There is a semantic change here, which is interesting. The presence of a similarly-named entity that is not visible can now affect typo correction. This is both good (you won't get weird corrections if the thing you wanted isn't in scope) and bad (you won't get good corrections if there is a similarly-named-but-completely-unrelated thing). Time will tell whether it was a good choice or not. llvm-svn: 116528
* Tweak the typo-correction implementation to determine correctionsDouglas Gregor2010-10-141-147/+109
| | | | | | | | | | | | | | | | | | | | | solely based on the names it sees, rather than actual declarations it gets. In essence, we determine the set of names that are "close enough" to the typo'd name. Then, we perform name lookup for each of those names, filtering out those that aren't actually visible, and typo-correct from the remaining results. Overall, there isn't much of a change in the behavior of typo correction here. The only test-suite change comes from the fact that we make good on our promise to require that the user type 3 characters for each 1 character corrected. The real intent behind this change is to set the stage for an optimization to typo correction (so that we don't need to deserialize all declarations in a translation unit) and future work in finding missing qualification ("'vector' isn't in scope; did you mean 'std::vector'?). Plus, the code is cleaner this way. llvm-svn: 116511
* zap more dead code.Chris Lattner2010-09-041-4/+1
| | | | llvm-svn: 113076
* Split ObjCInterfaceDecl::ReferencedProtocols into two lists: ↵Ted Kremenek2010-09-011-2/+3
| | | | | | | | | | | | | ReferencedProtocols and AllReferencedProtocols. ReferencedProtocols (and thus protocol_begin(), protocol_end()) now only contains the list of protocols that were directly referenced in an @interface declaration. 'all_referenced_protocol_[begin,end]()' now returns the set of protocols that were referenced in both the @interface and class extensions. The latter is needed for semantic analysis/codegen, while the former is needed to maintain the lexical information of the original source. Fixes <rdar://problem/8380046>. llvm-svn: 112691
* Make inline namespace not be transparent after all. The concept simply ↵Sebastian Redl2010-08-311-3/+7
| | | | | | doesn't fit. Instead, special-case the few places where transparent contexts have the desired behavior for inline namespaces. Fixes a redeclaration issue in inline namespaces. llvm-svn: 112637
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-0/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-1/+1
| | | | | | to the new constants. llvm-svn: 112047
* Split FunctionScopeInfo and BlockScopeInfo into their own header.John McCall2010-08-251-1/+2
| | | | llvm-svn: 112038
* Remove the DenseSet dependency from Sema.h.John McCall2010-08-251-0/+1
| | | | llvm-svn: 112030
* Move more stuff out of Sema.h.John McCall2010-08-251-1/+19
| | | | llvm-svn: 112026
* More header elimination. The goal of all this is to allow Parser toJohn McCall2010-08-241-0/+1
| | | | | | | #include Sema.h while keeping all the AST declarations opaque. That may not be reasonably attainable, though. llvm-svn: 111907
* DeclPtrTy -> Decl *John McCall2010-08-211-7/+7
| | | | llvm-svn: 111733
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-1/+1
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Extend the code-completion caching infrastructure to include globalDouglas Gregor2010-08-151-3/+36
| | | | | | | | | | | | | | | | | | 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
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
* Don't try to implicitly declare special members of an invalid class.John McCall2010-08-111-0/+4
| | | | | | Fixes a crash in a rather large and difficult-to-reduce test case. llvm-svn: 110882
* Added locations and type source info for DeclarationName.Abramo Bagnara2010-08-111-1/+1
| | | | llvm-svn: 110860
* If name lookup finds different type declarations in different scopesDouglas Gregor2010-08-111-21/+39
| | | | | | | | that actually refer to the same underlying type, it is not an ambiguity; add uniquing support based on the canonical type of type declarations. Fixes <rdar://problem/8296180>. llvm-svn: 110806
* Introduce -f{no-}spell-checking options to enable/disableDouglas Gregor2010-07-091-1/+1
| | | | | | | spell-checking. By default, spell-checking is enabled for Clang (obviously) but disabled in CIndex for performance reasons. llvm-svn: 107992
* Lazily declare default constructors. We now delay the construction ofDouglas Gregor2010-07-031-6/+18
| | | | | | | | | | | | | | | | | | declarations for implicit default constructors, copy constructors, copy assignment operators, and destructors. On a "simple" translation unit that includes a bunch of C++ standard library headers, we generate relatively few of these implicit declarations now: 4/159 implicit default constructors created 18/236 implicit copy constructors created 70/241 implicit copy assignment operators created 0/173 implicit destructors created And, on this translation unit, this optimization doesn't really provide any benefit. I'll do some more performance measurements soon, but this completes the implementation work for <rdar://problem/8151045>. llvm-svn: 107551
* Lazily declare implicit copy constructors.Douglas Gregor2010-07-021-8/+22
| | | | llvm-svn: 107543
* Introduce a new routine, LookupConstructors(), and use it for allDouglas Gregor2010-07-021-0/+10
| | | | | | constructor-name lookup. llvm-svn: 107536
* Lazily declare copy-assignment operators.Douglas Gregor2010-07-021-14/+66
| | | | llvm-svn: 107521
* Lazily declare the implicitly-declared destructor in a C++ class.Douglas Gregor2010-07-021-0/+49
| | | | llvm-svn: 107510
* Add a new routine Sema::LookupDestructor and make all destructor-lookup ↵Douglas Gregor2010-07-011-0/+10
| | | | | | calls use that routine llvm-svn: 107444
* Be a bit more careful with undefined CXXRecordDecls. FixesDouglas Gregor2010-07-011-1/+1
| | | | | | rdar://problem/8124080 and PR7118. llvm-svn: 107358
* A more minimal fix for PR6762.John McCall2010-05-281-55/+48
| | | | llvm-svn: 104991
OpenPOWER on IntegriCloud