summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Roll back r104941.John McCall2010-05-281-4/+0
| | | | llvm-svn: 104990
* Add a new attribute on records, __attribute__((adl_invisible)), and defineJohn McCall2010-05-281-0/+4
| | | | | | | | | | | | the x86-64 __va_list_tag with this attribute. The attribute causes the affected type to behave like a fundamental type when considered by ADL. (x86-64 is the only target we currently provide with a struct-based __builtin_va_list) Fixes PR6762. llvm-svn: 104941
* Optimize and complete associated-class-and-namespace collection fromJohn McCall2010-05-281-85/+115
| | | | | | a type. llvm-svn: 104938
* Reinstate r104117, Chandler Carruth's change that "[provides] a namingDouglas Gregor2010-05-201-1/+5
| | | | | | | class for UnresolvedLookupExprs, even when occuring on template names" along with a fix for an Objective-C++ crasher it introduced. llvm-svn: 104277
* Remove accidental commitDouglas Gregor2010-05-201-8/+2
| | | | llvm-svn: 104207
* Various small fixes for construction/destruction of Objective-C++Douglas Gregor2010-05-201-2/+8
| | | | | | | | | | instance variables: - Use isRecordType() rather than isa<RecordType>(), so that we see through typedefs in ivar types. - Mark the destructor as referenced - Perform C++ access control on the destructor llvm-svn: 104206
* Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even whenDaniel Dunbar2010-05-191-4/+1
| | | | | | | occuring on..." which breaks some Objective-C code. Working on getting a test case... llvm-svn: 104150
* Provide a naming class for UnresolvedLookupExprs, even when occuring onChandler Carruth2010-05-191-1/+4
| | | | | | | | | | | template names. We were completely missing naming classes for many unqualified lookups, but this didn't trigger code paths that need it. This removes part of an optimization that re-uses the template name lookup done by the parser to determine if explicit template arguments actually form a template-id. Unfortunately the technique for avoiding the duplicate lookup lost needed data such as the class context in which the lookup succeeded. llvm-svn: 104117
* Give a slight edge to the context-sensitive keyword 'super' overDouglas Gregor2010-05-181-1/+20
| | | | | | | | | non-function-local declarations with names similar to what the user typed. For example, this allows us to correct 'supper' to 'super' in an Objective-C message send, even though the C function 'isupper' has the same edit distance. llvm-svn: 104023
* Tweak typo-correction logic a bit regarding "super", so that weDouglas Gregor2010-05-181-0/+6
| | | | | | | | | consider "super" as a candidate whenever we're parsing an expression within an Objective-C method in an interface that has a superclass. At some point, we'd like to give "super" a little edge over non-local names; that will come later. llvm-svn: 104022
* Make sure to search semantic scopes and appropriate template-parameterDouglas Gregor2010-05-141-16/+48
| | | | | | | scopes during unqualified name lookup that has fallen out to namespace scope. Fixes PR7133. llvm-svn: 103766
* It turns out that basically every caller to RequireCompleteDeclContextJohn McCall2010-05-011-1/+1
| | | | | | | already knows what context it's looking in. Just pass that context in instead of (questionably) recalculating it. llvm-svn: 102818
* Fix ADL for types declared in transparent decls, from Alp Toker!Douglas Gregor2010-04-301-18/+16
| | | | llvm-svn: 102695
* When name lookup finds a single declaration that was imported via aDouglas Gregor2010-04-251-2/+3
| | | | | | | | using declaration, look at its underlying declaration to determine the lookup result kind (e.g., overloaded, unresolved). Fixes at least one issue in Boost.Bimap. llvm-svn: 102317
* When performing name lookup for an operator name, be sure to lookDouglas Gregor2010-04-251-4/+5
| | | | | | through using declarations. Fixes ~18 tests in Boost.Fusion. llvm-svn: 102311
* Recommit r102215, this time being more careful to only set the "principalJohn McCall2010-04-241-33/+7
| | | | | | | declaration" (i.e. the only which will actually be looked up) to have the non-member-operator bit. llvm-svn: 102231
* Revert r102215. This causes clang crash while compiling a test case from gdb ↵Devang Patel2010-04-241-7/+33
| | | | | | testsuite. llvm-svn: 102224
* Transition the last acceptable-result filter kind in LookupResult over to useJohn McCall2010-04-231-33/+7
| | | | | | a simple IDNS mask by introducing a namespace for non-member operators. llvm-svn: 102215
* Recommit my change to how C++ does elaborated type lookups, now withJohn McCall2010-04-231-32/+21
| | | | | | two bugfixes which fix selfhost and (hopefully) the nightly tests. llvm-svn: 102198
* Revert "C++ doesn't really use "namespaces" for different kinds of names the ↵Daniel Dunbar2010-04-231-22/+32
| | | | | | same", which seems to break most C++ nightly test apps. llvm-svn: 102174
* C++ doesn't really use "namespaces" for different kinds of names the sameJohn McCall2010-04-231-32/+22
| | | | | | | | | | | | | way that C does. Among other differences, elaborated type specifiers are defined to skip "non-types", which, as you might imagine, does not include typedefs. Rework our use of IDNS masks to capture the semantics of different kinds of declarations better, and remove most current lookup filters. Removing the last remaining filter is more complicated and will happen in a separate patch. Fixes PR 6885 as well some spectrum of unfiled bugs. llvm-svn: 102164
* Kill off IDNS_ObjCImplementation and IDNS_ObjCCategoryName; theyDouglas Gregor2010-04-221-6/+0
| | | | | | | aren't and never were used. There's a gap in the bit pattern for IDNS now, but I'm sure *someone* will fill it. llvm-svn: 102143
* When searching for code-completion and typo-correction candidates,Douglas Gregor2010-04-191-0/+15
| | | | | | | | look from an Objective-C class or category to its implementation, to pick up synthesized ivars. Fixes a problem reported by David Chisnall. llvm-svn: 101792
* Feed proper source-location information into Sema::LookupSingleResult,Douglas Gregor2010-04-151-3/+6
| | | | | | | | in case it ends up doing something that might trigger diagnostics (template instantiation, ambiguity reporting, access reporting). Noticed while working on PR6831. llvm-svn: 101412
* Teach typo correction about various language keywords. We can'tDouglas Gregor2010-04-141-27/+267
| | | | | | | | | | | | | generally recover from typos in keywords (since we would effectively have to mangle the token stream). However, there are still benefits to typo-correcting with keywords: - We don't make stupid suggestions when the user typed something that is similar to a keyword. - We can suggest the keyword in a diagnostic (did you mean "static_cast"?), even if we can't recover and therefore don't have a fix-it. llvm-svn: 101274
* Return the corrected DeclarationName from Sema::CorrectTypo ratherDouglas Gregor2010-04-141-15/+19
| | | | | | | | than just a bool indicating that correction occurred. No actual functionality change (it's still always used like a bool), but this refactoring will be used to support typo correction to keywords. llvm-svn: 101259
* Make CXXScopeSpec invalid when incomplete, and propagate that into anyJeffrey Yasskin2010-04-081-2/+2
| | | | | | | Declarator that depends on it. This fixes several redundant errors and bad recoveries. llvm-svn: 100779
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-2/+2
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* When performing name lookup for the allocation or deallocationDouglas Gregor2010-03-241-0/+17
| | | | | | | operators, make sure that the implicitly-declared global new and delete operators are always available. Fixes PR5904. llvm-svn: 99382
* When elevating access along an inheritance path, initialize the computedJohn McCall2010-03-181-1/+1
| | | | | | | | | | | | | | | | access to the (elevated) access of the accessed declaration, if applicable, rather than plunking that access onto the end after we've calculated the inheritance access. Also, being a friend of a derived class gives you public access to its members (subject to later modification by further inheritance); it does not simply ignore a single location of restricted inheritance. Also, when computing the best unprivileged path to a subobject, preserve the information that the worst path might be AS_none (forbidden) rather than a minimum of AS_private. llvm-svn: 98899
* During C++ name lookup, use DeclContext::Equals() rather thanDouglas Gregor2010-03-151-5/+3
| | | | | | | comparing DeclContext pointers, to avoid having to remember to call getPrimaryContext() everywhere. This is the last part PR6594. llvm-svn: 98546
* Implement C++ [temp.local]p8, which specifies that a templateDouglas Gregor2010-03-151-10/+93
| | | | | | | | | | | parameter hides a namespace-scope declararion with the same name in an out-of-line definition of a template. The lookup requires a strange interleaving of lexical and semantic scopes (go C++), which I have not yet handled in the typo correction/code completion path. Fixes PR6594. llvm-svn: 98544
* Eliminate the default arguments to ASTContext::getFunctionType(),Douglas Gregor2010-02-211-1/+2
| | | | | | | | fixing up a few callers that thought they were propagating NoReturn information but were in fact saying something about exception specifications. llvm-svn: 96766
* Implement C++ name lookup for instance variables of Objective-C classesDouglas Gregor2010-02-191-7/+30
| | | | | | | | | | | | from an instance method. Previously, we were following the Objective-C name lookup rules for ivars, which are of course completely different from and incompatible with the Objective-C++ rules. For the record, the Objective-C++ rules are the sane ones. This is another part of <rdar://problem/7660386>. llvm-svn: 96677
* In C++, allow builtins to be referred to via qualified name lookup, e.g.,Douglas Gregor2010-02-121-29/+48
| | | | | | | | ::__builtin_va_copy Fixes one of the Firefox issues in PR5511. llvm-svn: 95966
* Improve access control diagnostics. Perform access control on member-pointerJohn McCall2010-02-101-1/+1
| | | | | | | conversions. Fix an access-control bug where privileges were not considered at intermediate points along the inheritance path. Prepare for friends. llvm-svn: 95775
* Thread a source location into the template-argument deduction routines. ThereJohn McCall2010-02-081-1/+1
| | | | | | | may be some other places that could take advantage of this new information, but I haven't really looked yet. llvm-svn: 95600
* Teach C++ name lookup that it's okay to look in a scope without aDouglas Gregor2010-02-051-8/+10
| | | | | | | | context. This happens fairly rarely (which is why we got away with this bug). Fixes PR6184, where we skipped over the template parameter scope while tentatively parsing. llvm-svn: 95376
* Fix a crash with ill-formed code within a method in an ill-formedDouglas Gregor2010-02-041-3/+6
| | | | | | | category implementation, which showed up during (attempted) typo correction. Fixes <rdar://problem/7605289>. llvm-svn: 95334
* Extract a common structure for holding information about the definitionJohn McCall2010-02-041-0/+9
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* Add a stop gap to Sema::CorrectTypo() to correct only up to 20 typos.Ted Kremenek2010-02-021-1/+8
| | | | | | | | | | | | | | | | | This is to address a serious performance problem observed when running 'clang -fsyntax-only' on really broken source files. In one case, repeatedly calling CorrectTypo() caused one source file to be rejected after 2 minutes instead of 1 second. This patch causes typo correction to take neglible time on that file while still providing correction results for the first 20 cases. I felt this was a reasonable number for moderately broken source files. I don't claim this is the best solution. Comments welcome. It is necessary for us to address this issue because it is a serious performance problem. llvm-svn: 95049
* Return early, reduce indentation, and simplify line breaks. No functionalityChandler Carruth2010-01-311-65/+64
| | | | | | | | | change. PS: I'm under the impression formatting-only patches don't need pre-commit review, but feel free to yell at me if I should post these first! =D llvm-svn: 94956
* Handle redeclarations found by ADL deterministically and reasonably.John McCall2010-01-261-7/+42
| | | | | | | | | This solution relies on an O(n) scan of redeclarations, which means it might scale poorly in crazy cases with tons of redeclarations brought in by a ton of distinct associated namespaces. I believe that avoiding this is not worth the common-case cost. llvm-svn: 94530
* Allow ADL to find functions imported by using decls. Leave wordy commentJohn McCall2010-01-261-10/+14
| | | | | | about interaction between ADL and default arguments. Shrug shoulders, commit. llvm-svn: 94524
* Preserve access bits through overload resolution much better. SomeJohn McCall2010-01-261-15/+13
| | | | | | general refactoring in operator resolution. llvm-svn: 94498
* Implement elementary access control.John McCall2010-01-231-2/+10
| | | | llvm-svn: 94268
* First pass at collecting access-specifier information along inheritance paths.John McCall2010-01-201-3/+9
| | | | | | | | Triggers lots of assertions about missing access information; fix them. Will actually consume this information soon. llvm-svn: 94038
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-7/+11
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* Make LookupResult::resolveKind() robust against NotFoundInCurrentInstantiation.John McCall2010-01-151-1/+1
| | | | | | Fixes PR 6049. llvm-svn: 93557
* When performing qualified name lookup into the current instantiation,Douglas Gregor2010-01-151-20/+24
| | | | | | | | | | | | | do not look into base classes if there are any dependent base classes. Instead, note in the lookup result that we couldn't look into any dependent bases. Use that new result kind to detect when this case occurs, so that we can fall back to treating the type/value/etc. as a member of an unknown specialization. Fixes an issue where we were resolving lookup at template definition time and then missing an ambiguity at template instantiation time. llvm-svn: 93497
OpenPOWER on IntegriCloud