summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* <rdar://problem/13317030> Consider using directives when performing ↵Douglas Gregor2013-03-271-1/+15
| | | | | | unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy. llvm-svn: 178136
* Remove -Wspellcheck and replace it with a diagnostic option.Argyrios Kyrtzidis2013-03-161-5/+6
| | | | | | | Thanks to Richard S. for pointing out that the warning would show up with -Weverything. llvm-svn: 177218
* Don't try to typo-correct 'super' in an objc method.Argyrios Kyrtzidis2013-03-141-0/+10
| | | | | | | | | | | | | | | | | | | | | This created 2 issues: 1) Performance issue, since typo-correction with PCH/modules is rather expensive. 2) Correctness issue, since if it managed to "correct" 'super' then bogus compiler errors would be emitted, like this: 3.m:8:3: error: unknown type name 'super'; did you mean 'super1'? super.x = 0; ^~~~~ super1 t3.m:5:13: note: 'super1' declared here typedef int super1; ^ t3.m:8:8: error: expected identifier or '(' super.x = 0; ^ llvm-svn: 177126
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-1/+1
| | | | | | No (intended) functionality change. llvm-svn: 176726
* In LookupResult::resolveKind(), when handling multiple found declarations, ↵Argyrios Kyrtzidis2013-02-221-0/+6
| | | | | | | | | ignore invalid declarations. This reduces the "ambiguous reference" errors (which are rather strange in C/ObjC) and fixes an assertion hit with an invalid code test case. llvm-svn: 175869
* Preserve Sema::UndefinedInternals across PCH boundaries. FixesNick Lewycky2013-01-261-1/+1
| | | | | | -Wundefined-internal warnings with PCH. llvm-svn: 173538
* Rework the traversal of Objective-C categories and extensions toDouglas Gregor2013-01-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. llvm-svn: 172665
* PR14950: Fix out-of-bounds function parameter access in literal operator lookup.Richard Smith2013-01-151-1/+1
| | | | llvm-svn: 172514
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-5/+5
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-9/+9
| | | | llvm-svn: 171367
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-25/+28
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-10/+10
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Consistently use 'needsImplicit<special member>' to determine whether we needRichard Smith2012-12-011-10/+10
| | | | | | | an implicit special member, rather than sometimes using '!hasDeclared<special member>'. No functionality change. llvm-svn: 169075
* Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,Argyrios Kyrtzidis2012-11-281-3/+2
| | | | | | expose only the iterators instead. llvm-svn: 168770
* Simplify checking for whether we should implicitly declare special members andRichard Smith2012-11-271-16/+9
| | | | | | add some assertions. No functionality change. llvm-svn: 168725
* When adding a NamedDecl to a correction, add the underlying Decl (viaKaelyn Uhrain2012-11-191-1/+1
| | | | | | | | getUnderlyingDecl()) so that derivatives of CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry about being thrown by UsingDecls and such. llvm-svn: 168317
* DR1442: In a range-based for statement, namespace 'std' is not an associatedRichard Smith2012-10-181-4/+1
| | | | | | namespace. llvm-svn: 166194
* Fix typo correction of one qualified name to another.David Blaikie2012-10-121-2/+6
| | | | | | | | | | | | | | When suggesting "foo::bar" as a correction for "fob::bar" we mistakenly replaced only "bar" with "foo::bar" producing "fob::foo::bar" which was broken. This corrects that replacement in as many places as I could find & provides test cases for all those cases I could find a test case for. There are a couple that don't seem to be reachable (one looks entirely dead, the other just doesn't seem to ever get called with a namespace to namespace change). Review by Richard Smith ( http://llvm-reviews.chandlerc.com/D57 ). llvm-svn: 165817
* Fix the AST representation for non-type template arguments to encodeEli Friedman2012-09-261-0/+1
| | | | | | | | | | | | enough information so we can mangle them correctly in cases involving dependent parameter types. (This specifically impacts cases involving null pointers and cases involving parameters of reference type.) Fix the mangler to use this information instead of trying to scavenge it out of the parameter declaration. <rdar://problem/12296776>. llvm-svn: 164656
* Remove Context argument from TemplateDeductionInfo constructor. It was no ↵Craig Topper2012-09-191-1/+1
| | | | | | longer needed after the unused Context member was removed in r164104. llvm-svn: 164196
* Remove RequireCompleteType call which was made redundant by r162586.Richard Smith2012-08-241-7/+0
| | | | llvm-svn: 162630
* Instantiate class template specializations during ADL.John McCall2012-08-241-7/+13
| | | | llvm-svn: 162586
* Fix PR13394: Erasing from a vector changes the end of the vector, so make ↵Benjamin Kramer2012-07-271-3/+3
| | | | | | sure we always have the right end. llvm-svn: 160855
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-2/+2
| | | | llvm-svn: 160622
* PR13381: consider cv-qualifiers on a class member's type when determining whichRichard Smith2012-07-181-4/+7
| | | | | | | constructor will be used for moving that object, in the computation of its exception specification. llvm-svn: 160417
* Add support for the C11 _Alignof keyword.Jordan Rose2012-06-301-0/+6
| | | | | | | This behaves like the existing GNU __alignof and C++11 alignof keywords; most of the patch is simply adding the third token spelling to various places. llvm-svn: 159494
* Documentation cleanup: making \param and \returns docs match the code.James Dennett2012-06-221-8/+5
| | | | llvm-svn: 158985
* Documentation cleanup: making \param docs match the code.James Dennett2012-06-221-13/+3
| | | | llvm-svn: 158982
* Documentation cleanup: escape "::", and other minor reformattingJames Dennett2012-06-191-1/+2
| | | | llvm-svn: 158741
* PR13051: Only suggest the 'template' and 'operator' keywords when performingRichard Smith2012-06-081-2/+11
| | | | | | typo-correction after a scope specifier. llvm-svn: 158231
* Allow CorrectTypo to add/modify nested name qualifiers to typos thatKaelyn Uhrain2012-06-061-3/+16
| | | | | | | | | are otherwise too short to try to correct. The TODOs added to two of the tests are for existing deficiencies in the typo correction code that could be exposed by using longer identifiers. llvm-svn: 158109
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-1/+1
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-021-1/+1
| | | | llvm-svn: 157886
* Don't allow multiple correction candidates that have the same identifierKaelyn Uhrain2012-06-011-25/+53
| | | | | | | | but different nested name specifiers to quietly clobber each other so only one remains if they do not refer to the same NamedDecl. Fixes PR12951. llvm-svn: 157823
* In TypoCorrectionConsumer, BestResults to CorrectionResults to lessenKaelyn Uhrain2012-05-311-14/+19
| | | | | | | | | | the confusion among all of the uses of Best* in relation to the set of possible typo correction results. Also add a method to return the set of typo corrections that have the single best edit distance--it returns the second half of the first pair in TypoEditDistanceMap (with getBestEditDistance already returning the first half). llvm-svn: 157781
* Implement simplify_type traits for redecl_iterator.David Blaikie2012-05-011-1/+1
| | | | | | Based on Chandler Carruth's feedback on r155869. llvm-svn: 155929
* Remove ref/value inconsistency in redecl_iterator.David Blaikie2012-05-011-1/+1
| | | | | | | | | | | | | Similar to r155808 - this mistake has been made in a few iterators. Based on Chandler Carruth's feedback to r155808 I added an implicit conversion to Decl* to ease adoption/usage. Useful for the pointer comparison, but not the dyn_cast (due to template argument deduction causing the conversion not to be used) - there for future convenience, though. This idiom (op T* for iterators) seems to be fairly idiomatic within the LLVM codebase & I'll likely add it as I fix up the other iterators here. llvm-svn: 155869
* Fix bug where a class's (deleted) copy constructor would be implicitly given aRichard Smith2012-04-201-31/+14
| | | | | | | | non-const reference parameter type if the class had any subobjects with deleted copy constructors. This causes a rejects-valid if the class's copy constructor is explicitly defaulted (as happens for some implementations of std::pair etc). llvm-svn: 155218
* Directly store TypoResultsMaps in the TypoEditDistanceMap, getting rid of ↵Benjamin Kramer2012-04-141-27/+15
| | | | | | manual deletion. llvm-svn: 154736
* Delete the TypoResultsMap when erasing the pointer to it.Benjamin Kramer2012-04-131-7/+6
| | | | | | | This manual deleting is error-prone, but we can't just put an OwningPtr in a std::map :( llvm-svn: 154707
* Remove more redundant lookups. Add a new "all_lookups_iterator" which providesNick Lewycky2012-04-031-15/+6
| | | | | | | | a view over the contents of a DeclContext without exposing the implementation details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the visible declarations. Fixes PR12339! llvm-svn: 153970
* Don't treat synthesized ivars as being in the base class for the purpose ofNick Lewycky2012-04-031-5/+5
| | | | | | looking up visible decls. llvm-svn: 153967
* Replace the workaround from r153445 with a proper fix.Kaelyn Uhrain2012-04-031-1/+1
| | | | | | | | | | | | | Infinite recursion was happening when DiagnoseInvalidRedeclaration called ActOnFunctionDeclarator to check if a typo correction works when the correction was just to the nested-name-specifier because the wrong DeclContext was being passed in. Unlike a number of functions surrounding typo correction, the DeclContext passed in for a function is the context of the function name after applying any nested name specifiers, not the lexical DeclContext where the function+nested-name-specifier appears. llvm-svn: 153962
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-7/+13
| | | | | | member function is deleted. llvm-svn: 153773
* When diagnosing an invalid out-of-line redeclaration, don't permitDouglas Gregor2012-03-261-4/+11
| | | | | | | typo correction to introduce a nested-name-specifier; we aren't prepared to handle it here. Fixes PR12297 / <rdar://problem/11075219>. llvm-svn: 153445
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-231-2/+1
| | | | | | | class template's definition, and for explicit specializations of such enum members. llvm-svn: 153304
* It never makes sense to do a lookup into a LinkageSpecDecl, so assert that weNick Lewycky2012-03-131-5/+6
| | | | | | | | | don't, and clean up the places that do it. The change to ASTWriter is surprising, but the deleted code is a no-op as of r152608. llvm-svn: 152609
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. llvm-svn: 152608
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-33/+33
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Improve our semantic error recovery.Argyrios Kyrtzidis2012-03-091-4/+0
| | | | | | | | | | | | | | | | | When an error made a record member invalid, the record would stay as "isBeingDefined" and not "completeDefinition". Even easily recoverable errors ended up propagating records in such "beingDefined" state, for example: struct A { ~A() const; // expected-error {{'const' qualifier is not allowed on a destructor}} }; struct B : A {}; // A & B would stay as "not complete definition" and "being defined". This weird state was impending lookups in the records and hitting assertion in the ASTWriter. Part of rdar://11007039 llvm-svn: 152432
OpenPOWER on IntegriCloud