summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprMember.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix diagnostic for static methods referencing fields from using declsReid Kleckner2014-12-181-2/+4
| | | | | | | | | | | | Previously we thought the instance member was a function, not a field, and we'd say something silly like: t.cpp:4:27: error: call to non-static member function without an object argument static int f() { return n; } ^ Noticed in PR21923. llvm-svn: 224480
* Perform correct lookup when '__super' is used in class with dependent base.Nikola Smiljanic2014-12-011-1/+1
| | | | llvm-svn: 223090
* Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping theKaelyn Takata2014-11-111-68/+34
| | | | | | | | | code for calling CorrectTypo. Includes a needed fix for non-C++ code to not choke on TypoExprs (which also resolves a TODO from r220698). llvm-svn: 221736
* Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.Kaelyn Takata2014-11-111-83/+39
| | | | llvm-svn: 221734
* Explicitly exclude keywords from the member validator.Kaelyn Takata2014-11-111-10/+9
| | | | | | Also simply and remove dead code from MemberExprTypoRecovery. llvm-svn: 221723
* Fix some formatting prior to refactoring the code.Kaelyn Takata2014-11-111-21/+23
| | | | llvm-svn: 221722
* Wire up LookupMemberExpr to use the new TypoExpr.Kaelyn Takata2014-10-271-9/+105
| | | | | | | | This includes adding the new TypoExpr-based lazy typo correction to LookupMemberExprInRecord as an alternative to the existing eager typo correction. llvm-svn: 220698
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-8/+7
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-3/+1
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
* Refactor: use the DeclarationNameInfo form of BuildMemberReferenceExprRichard Smith2014-05-311-152/+142
| | | | | | | consistently, rather than sometimes performing lookup and calling the LookupResult form. No functionality change intended. llvm-svn: 209941
* Refactoring. Remove Owned method from Sema.Nikola Smiljanic2014-05-291-57/+39
| | | | llvm-svn: 209812
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-18/+18
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-33/+31
| | | | llvm-svn: 209613
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-231-2/+4
| | | | | | symbols in non-imported modules. llvm-svn: 206977
* vector [Sema]. Check for proper use of 's' char prefixFariborz Jahanian2014-04-031-1/+1
| | | | | | | (which indicates vector expression is a string of hex values) instead of crashing in code gen. // rdar://16492792 llvm-svn: 205557
* Cleanup dead assignments reported by scan-buildArnaud A. de Grandmaison2014-03-231-2/+0
| | | | llvm-svn: 204569
* [C++11] Replacing ObjCObjectPointerType iterators qual_begin() and ↵Aaron Ballman2014-03-171-8/+5
| | | | | | qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204048
* [C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-131-3/+2
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203863
* [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with ↵Aaron Ballman2014-03-131-4/+2
| | | | | | iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203803
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-1/+1
| | | | | | class. llvm-svn: 203640
* PR12788: Remove unnecessary and incorrect special case for indirect fields.Richard Smith2014-01-171-8/+1
| | | | | | This caused us to skip a step that was essential for correct access control. llvm-svn: 199522
* It turns out the problem was a bit more wide-spread. Removing a lot of ↵Aaron Ballman2014-01-031-2/+1
| | | | | | | | unneeded typecasts. getScopeRep() already returns a NestedNameSpecifier. No functional changes intended. llvm-svn: 198414
* This patch implements capturing of variables within generic lambdas.Faisal Vali2013-11-071-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks. What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing. As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable. Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas. What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda. Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming. This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being: - generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ... - nested variadic expansions such as: auto K = [](auto ... OuterArgs) { vp([=](auto ... Is) { decltype(OuterArgs) OA = OuterArgs; return 0; }(5)...); return 0; }; auto M = K('a', ' ', 1, " -- ", 3.14); currently cause crashes. I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard. A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless! Now let's hope this commit doesn't upset the buildbot gods ;) Thanks! llvm-svn: 194188
* Fix a C struct diagnostic regression introduced by r187504 (PR17762).Kaelyn Uhrain2013-10-311-0/+5
| | | | llvm-svn: 193799
* Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.Kaelyn Uhrain2013-10-191-3/+32
| | | | | | | | | | | Now that CorrectTypo knows how to correctly search classes for typo correction candidates, there is no good reason to only replace an existing CXXScopeSpecifier if it refers to a namespace. While the actual enablement was a matter of changing a single comparison, the fallout from enabling the functionality required a lot more code changes (including my two previous commits). llvm-svn: 193020
* Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith2013-08-171-25/+12
| | | | | | | preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
* Improve the diagnostic experience, including adding recovery, forKaelyn Uhrain2013-07-311-4/+2
| | | | | | changing '->' to '.' when there is no operator-> defined for a class. llvm-svn: 187504
* Fix member refs with using decl + anonymous union.Eli Friedman2013-07-161-10/+14
| | | | | | | | | | Make sure we call BuildFieldReferenceExpr with the appropriate decl when a member of an anonymous union is made public with a using decl. Also, fix a crash on invalid field access into an anonymous union. Fixes PR16630. llvm-svn: 186367
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-021-1/+3
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* address some comments on r183474:Adrian Prantl2013-06-071-4/+6
| | | | | | | | | | - factor the name construction part out from constructSetterName - rename constructSetterName to the more appropriate constructSetterSelector no functionality change intended. rdar://problem/14035789 llvm-svn: 183582
* Objective-C arc: don't count use of __weakFariborz Jahanian2013-05-211-1/+1
| | | | | | | variables when they are used in such unevaluated contexts as __typeof, etc. // rdar://13942025 llvm-svn: 182423
* When typo correction produces an overloaded result when looking up a member,Nick Lewycky2013-05-071-4/+18
| | | | | | | | | return all the overloads instead of just picking the first possible declaration. This removes an invalid note (and on occasion other invalid diagnostics) and also makes clang's parsing recovery behave as if the text from its fixit were applied. llvm-svn: 181370
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-17/+34
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-1/+19
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Objective-C: Provide fixit hints when warningFariborz Jahanian2013-04-021-1/+1
| | | | | | | | about 'isa' ivar being explicitely accessed when base is a user class object reference. // rdar://13503456 llvm-svn: 178562
* Objective-C: Produce precise diagnostic whenFariborz Jahanian2013-03-281-13/+0
| | | | | | | | 'isa' ivar is accessed provided it is the first ivar. Fixit hint will follow in another patch. This is continuation of // rdar://13503456 llvm-svn: 178313
* Objective-C: Provide fixit suggestions when class objectFariborz Jahanian2013-03-281-0/+1
| | | | | | | | is accessed via accessing 'isa' ivar to use object_getClass/object_setClass apis. // rdar://13503456 llvm-svn: 178282
* Objective-C: Issue more precise warning when userFariborz Jahanian2013-03-271-4/+1
| | | | | | | is accessing 'isa' as an object pointer. // rdar://13503456. FixIt to follow in another patch. llvm-svn: 178179
* Fix assertion failure when a field is given an address space.Matt Arsenault2013-02-261-8/+8
| | | | llvm-svn: 176122
* objective-C: When implementing custom accessor method forFariborz Jahanian2013-02-141-1/+2
| | | | | | | | a property, the -Wdirect-ivar-access should not warn when accessing the property's synthesized instance variable. // rdar://13142820 llvm-svn: 175195
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-1/+1
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | 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
* Fix regression in r168477. Use canonical decl when looking for base classRichard Smith2012-11-221-1/+1
| | | | | | specified as a qualified name. llvm-svn: 168479
* Fix CXXRecordDecl::forallBases to not look through bases which are dependentRichard Smith2012-11-221-36/+26
| | | | | | | | and defined within the current instantiation, but which are not part of the current instantiation. Previously, it would look at bases which could be specialized separately from the current template. llvm-svn: 168477
* From Vassil Vassilev: enable Sema to deal with multiple ExternalSemaSources.Axel Naumann2012-10-181-1/+1
| | | | llvm-svn: 166208
* Fix typo correction of one qualified name to another.David Blaikie2012-10-121-1/+2
| | | | | | | | | | | | | | 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
* Change (!ptr != 0) to (!ptr) to make the code more readable.Richard Trieu2012-10-121-1/+1
| | | | | | No functional change. llvm-svn: 165811
* -Warc-repeated-use-of-weak: check ivars and variables as well.Jordan Rose2012-09-281-3/+18
| | | | | | | | | | Like properties, loading from a weak ivar twice in the same function can give you inconsistent results if the object is deallocated between the two loads. It is safer to assign to a strong local variable and use that. Second half of <rdar://problem/12280249>. llvm-svn: 164855
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-3/+3
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Random string removal.Eric Christopher2012-08-161-1/+1
| | | | llvm-svn: 162063
OpenPOWER on IntegriCloud