summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use concrete type instead of auto in for-loop. No functionality change.Richard Trieu2015-04-151-1/+1
| | | | llvm-svn: 234976
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-1/+1
| | | | | | No functionality change. llvm-svn: 234964
* [modules] Allow a function to be redefined if the old definition is not visible.Richard Smith2015-03-271-2/+1
| | | | llvm-svn: 233407
* [modules] Handle defining a class template on top of an existing ↵Richard Smith2015-03-271-2/+18
| | | | | | imported-but-not-visible definition. llvm-svn: 233341
* [modules] Remove redundant import of lexical decls when building a lookup tableRichard Smith2015-03-231-6/+34
| | | | | | | | | | | | | | | for a DeclContext, and fix propagation of exception specifications along redeclaration chains. This reverts r232905, r232907, and r232907, which reverted r232793, r232853, and r232853. One additional change is present here to resolve issues with LLDB: distinguish between whether lexical decls missing from the lookup table are local or are provided by the external AST source, and still look in the external source if that's where they came from. llvm-svn: 232928
* Reverting r232793 until some new LLDB failures are discussedVince Harron2015-03-221-34/+6
| | | | llvm-svn: 232905
* [modules] Remove some redundant work when building a lookup table for a ↵Richard Smith2015-03-201-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | DeclContext. When we need to build the lookup table for a DeclContext, we used to pull in all lexical declarations for the context; instead, just build a lookup table for the local lexical declarations. We previously didn't guarantee that the imported declarations would be in the returned map, but in some cases we'd happen to put them all in there regardless. Now we're even lazier about this. This unnecessary work was papering over some other bugs: - LookupVisibleDecls would use the DC for name lookups in the TU in C, and this was not guaranteed to find all imported names (generally, the DC for the TU in C is not a reliable place to perform lookups). We now use an identifier-based lookup mechanism for this. - We didn't actually load in the list of eagerly-deserialized declarations when importing a module (so external definitions in a module wouldn't be emitted by users of those modules unless they happened to be deserialized by the user of the module). llvm-svn: 232793
* Sema: Replace the SetVector/DenseMap/std::sort combination with a simple ↵Benjamin Kramer2015-03-131-21/+1
| | | | | | | | | | | | std::map This guarantees the order and doesn't increase malloc counts a lot as there are typically very few elements int the map. Provide a little iterator adapter to keep the same interface as we had with the flat sorted list. No functional change intended. llvm-svn: 232173
* [modules] Rework merging of redeclaration chains on module import.Richard Smith2015-03-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | We used to save out and eagerly load a (potentially huge) table of merged formerly-canonical declarations when we loaded each module. This was extremely inefficient in the presence of large amounts of merging, and didn't actually save any merging lookup work, because we still needed to perform name lookup to check that our merged declaration lists were complete. This also resulted in a loss of laziness -- even if we only needed an early declaration of an entity, we would eagerly pull in all declarations that had been merged into it regardless. We now store the relevant fragments of the table within the declarations themselves. In detail: * The first declaration of each entity within a module stores a list of first declarations from imported modules that are merged into it. * Loading that declaration pre-loads those other entities, so that they appear earlier within the redeclaration chain. * The name lookup tables list the most recent local lookup result, if there is one, or all directly-imported lookup results if not. llvm-svn: 231424
* Cleanup: remove artificial division between lookup results and const lookupRichard Smith2015-02-211-2/+2
| | | | | | | results. No-one was ever modifying a lookup result, and it would not be reasonable to do so. llvm-svn: 230123
* PR21857: weaken an incorrect assertion.Richard Smith2015-02-111-2/+12
| | | | llvm-svn: 228785
* [modules] When determining whether a name from a module replaces a name weRichard Smith2015-02-101-0/+5
| | | | | | | | | already have, check whether the name from the module is actually newer than the existing declaration. If it isn't, we might (say) replace a visible declaration with an injected friend, and thus make it invisible (or lose a default argument or an array bound). llvm-svn: 228661
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-061-12/+8
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* Use the real CXXScopeSpec when setting the correction SourceRange.Kaelyn Takata2015-01-281-1/+1
| | | | | | | | | Otherwise, in the most important case and the only case where SS and TempSS are different (which is when the CXXScopeSpec should be dropped, and TempSS is NULL) the wrong SourceRange will be used in the fixit for the typo correction. Fixes the remaining issue in PR20626. llvm-svn: 227278
* Fix a case where delayed typo correction should have resolved anKaelyn Takata2015-01-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ambiguity but wasn't. In the new test case, "click" wasn't being corrected properly because Sema::ClassifyName would call CorrectTypo for "click" then later Sema::DiagnoseEmptyLookup would call CorrectTypoDelayed for the same use of "click" (the former by the parser needing to determine what the identifier is so it knows how to parse the statement, i.e. is it the beginning of a declaration or an expression). CorrectTypo would record that typo correction for "click" failed and CorrectTypoDelayed would see that and not even try to correct the typo, even though in this case CorrectTypo failed due to an ambiguity (both "Click" and "clock" having an edit distance of one from "click") that could be resolved with more information. The fix is two-fold: 1) Have CorrectTypo not record failed corrections if the reason for the failure was two or more corrections with the same edit distance, and 2) Make the CorrectionCandidateCallback used by Parser::ParseCastExpression reject FunctionDecl candidates when the next token after the identifier is a ".", "=", or "->" since functions cannot be assigned to and do not have members that can be referenced. The reason for two correction spots is that from r222549 until r224375 landed, the first correction attempt would fail completely but the second would suggest "clock" while having the note point to the declaration of "Click". llvm-svn: 226334
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-161-69/+16
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* Perform correct lookup when '__super' is used in class with dependent base.Nikola Smiljanic2014-12-011-0/+25
| | | | llvm-svn: 223090
* Correctly set the SourceRange a TypoCorrection will replace.Kaelyn Takata2014-11-201-3/+5
| | | | | | Also clean up TypoCorrection::setCorrectionRange while we're at it. llvm-svn: 222460
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-10/+10
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* Wrap to 80 columns, no behavior change.Nico Weber2014-11-191-1/+2
| | | | llvm-svn: 222315
* Make LookupResult be copyable to avoid decomposing an existing one andKaelyn Takata2014-11-111-6/+6
| | | | | | initializing a new one every time a copy is needed. llvm-svn: 221724
* Add a callback for recovering using a typo correction.Kaelyn Takata2014-10-271-5/+9
| | | | | | | Also keep track of the stack of Exprs visited during the tree transform so the callback can be passed the parent of the TypoExpr. llvm-svn: 220697
* Add simple way for a CorrectionCandidateCallback to reject exactKaelyn Takata2014-10-271-47/+50
| | | | | | | | | | | | | | | matches of the typo. Also be more proactive about checking a correction's visibility so that a correction requiring a module import can be distinguished from the original typo even if it looks identical. Otherwise the correction will be excluded and the diagnostic about needing the module import won't be emitted. Note that no change was made to checkCorrectionVisibility other than moving where it is at in SemaLookup.cpp. llvm-svn: 220696
* Start adding the infrastructure for handling TypoExprs.Kaelyn Takata2014-10-271-104/+213
| | | | | | | | | | | | | | | | Part of the infrastructure is a map from a TypoExpr to the Sema-specific state needed to correct it, along with helpers to ease dealing with the state. The the typo count is propagated up the stack of ExpressionEvaluationContextRecords when one is popped off of to avoid accidentally dropping TypoExprs on the floor. For example, the attempted correction of g() in test/CXX/class/class.mem/p5-0x.cpp happens with an ExpressionEvaluationContextRecord that is popped off the stack prior to ActOnFinishFullExpr being called and the tree transform for TypoExprs being run. llvm-svn: 220695
* Have TypoCorrectionConsumer remember the TypoCorrections it returned.Kaelyn Takata2014-10-271-4/+12
| | | | | | | | | | | Two additional methods are provided: one to return the current correction (the last correction returned by getNextCorrection), and one to "reset" the state so that getNextCorrection will return the previous corrections before returning any new corrections. Also ensure that all TypoCorrections have valid source ranges. llvm-svn: 220694
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-11/+16
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Move TypoCorrectionConsumer into a header.Kaelyn Takata2014-10-271-151/+2
| | | | | | | | | This makes it available outside of SemaLookup.cpp, as needed for the forthcoming TypoExpr AST node which will keep a TypoCorrectionConsumer that provides the possible typo corrections for that TypoExpr. llvm-svn: 220691
* Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helperReid Kleckner2014-10-141-15/+2
| | | | | | | | | | | | | | | | | This moves some code from SemaType.cpp's hasVisibleDefinition() into DeclCXX.cpp so that it can be used elsewhere. I found one other instance of code trying to do the same thing, there are probably more. Search for getInstantiatedFrom() to try to find more. No functionality change. Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5783 llvm-svn: 219714
* -ms-extensions: Allow __super in return stements.Nikola Smiljanic2014-10-041-2/+11
| | | | llvm-svn: 219050
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-0/+21
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-301-2/+2
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216824
* Factor out exception specification information fromRichard Smith2014-07-311-2/+1
| | | | | | | | FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care about the other ExtProtoInfo bits and just want to talk about the exception specification. llvm-svn: 214450
* Add another keyword-selection flag to CorrectionCandidateCallback.Kaelyn Takata2014-07-281-1/+9
| | | | | | | | | | The new flag, WantFunctionLikeCasts, covers a subset of the keywords covered by WantTypeSpecifiers that can be used in casts that look like function calls, e.g. "return long(5);", while excluding the keywords like "enum" and "const" that would be included when WantTypeSpecifiers is true but cannot be used in something that looks like a function call. llvm-svn: 214109
* Switching some iterator-based for loops to use range-based for loops. No ↵Aaron Ballman2014-07-151-49/+28
| | | | | | functional changes intended. llvm-svn: 213098
* Added the pack_elements range accessor. Refactoring some for loops to use ↵Aaron Ballman2014-07-151-4/+2
| | | | | | range-based for loops instead. No functional changes intended. llvm-svn: 213095
* Fix typos.Nikola Smiljanic2014-07-091-1/+1
| | | | llvm-svn: 212589
* Propagate isAddressOfMember into typo correction so that we don't correct ↵Nick Lewycky2014-06-231-6/+19
| | | | | | &qualified-id into &unqualified-id. Also make sure to set the naming class when we find the qualified-id in a different class than the nested name specifier specified so far. Fixes PR19681! llvm-svn: 211551
* Fix the caller of checkCorrectionVisibility too.Kaelyn Takata2014-06-171-1/+1
| | | | | | | | That's what I get for hurredly splitting the small change out of a much bigger change that had moved where checkCorrectionVisibility was being called. llvm-svn: 211134
* Remove an unused argument from checkCorrectionVisibility.Kaelyn Takata2014-06-171-2/+1
| | | | llvm-svn: 211133
* Fix the VS2012 build.Hans Wennborg2014-06-111-5/+7
| | | | | | It didn't handle the in-class member initializer and compound literal. llvm-svn: 210707
* Add some comments to TypoCorrectionConsumer.Kaelyn Takata2014-06-111-26/+49
| | | | | | | | | | | Also move the constructor for NamespaceSpecifierSet out of line to improve the class' readability. I meant to do these two things while cleaning up the previous TypoCorrectionConsumer changes and have them folded into those changes. No functionality changed. llvm-svn: 210686
* Sink SpecifierInfo into the only class that uses it.Kaelyn Takata2014-06-111-18/+13
| | | | | | | | | | | | | SpecifierInfo is not used outside of NamespaceSpecifierSet except indirectly through NamespaceSpecifierSet's iterator, so clean up the code a bit by moving SpecifierInfo into NamespaceSpecifierSet. Also drop SpecifierInfo's trivial yet verbose constructor since brace initiialization is sufficient in the only two places the constructor was being explicitly called. No functionality changed. llvm-svn: 210672
* Make a couple of helper classes private to TypoCorrectionConsumer.Kaelyn Takata2014-06-111-81/+87
| | | | | | | | | | | The SpecifierInfo and NamespaceSpecifierSet are now only used by TypoCorrectionConsumer, so treat them as the implementation details of TypoCorrectionConsumer that they are. Also make NamespaceSpecifierSet's method names more style guide compliant. No functionality changed. llvm-svn: 210671
* Clean up the TypoCorrectionConsumer's interface a bit.Kaelyn Takata2014-06-111-37/+26
| | | | | | No functionality changed. llvm-svn: 210670
* Move TypoCorrection filtering into the TypoCorrectionConsumer and make it ↵Kaelyn Takata2014-06-111-257/+253
| | | | | | | | | | | | incremental. The only external/visible functional change that fell out of this refactoring is that there was one less case where the typo caching and/or counting didn't work properly. The result is that a test case had to be moved from typo-correction.cpp to typo-correction-pt2.cpp to avoid the hard-coded limit on per file/TU typo correction attempts. llvm-svn: 210669
* Move a few classes to be before TypoCorrectionConsumer.Kaelyn Takata2014-06-111-129/+134
| | | | | | | | | | | This is in preparation for moving TypoCorrection filtering into the TypoCorrectionConsumer, to separate out some of the purely mechanical churn. It also makes some of the method names in NamespaceSpecifierSet be more style guide compliant. No functionality changed. llvm-svn: 210668
* Remove a redundant conditional when caching typo failures.Kaelyn Takata2014-06-101-6/+5
| | | | | | No functionality change. llvm-svn: 210583
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-44/+45
| | | | llvm-svn: 209613
* fmodules-search-all: Removed dead code and added some comments.John Thompson2014-05-071-6/+5
| | | | llvm-svn: 208259
* If an instantiation of a template is required to be a complete type, checkRichard Smith2014-05-071-3/+3
| | | | | | | whether the definition of the template is visible rather than checking whether the instantiated definition happens to be in an imported module. llvm-svn: 208150
OpenPOWER on IntegriCloud