summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/typo-correction-delayed.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert r301487: Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-6/+1
| | | | | | This reverts commit r301487 to make buildbots green. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301491 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-1/+6
| | | | | | | | | | | | The previous algorithm processed one character at a time, which is very painful on a modern CPU. Replace it with xxHash64, which both already exists in the codebase and is fairly fast. Patch from Scott Smith! Differential Revision: https://reviews.llvm.org/D32509 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301487 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lit Test] Updated 20 Lit tests to be C++11 compatible.Charles Li2015-12-101-2/+6
| | | | | | | | This is the 5th Lit test patch. Expanded expected diagnostics to vary by C++ dialect. Expanded RUN line to: default, C++98/03 and C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255196 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose delayed typos when parsing a postfix expression with anKaelyn Takata2015-05-021-0/+6
| | | | | | | | unmatched l_paren before setting the LHS to ExprError(). Fixes PR23285. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236371 91177308-0d34-0410-b5e6-96231b3b80d8
* Also correct typos in the middle of a ternary expression when the RHS is ↵Kaelyn Takata2015-05-011-0/+5
| | | | | | | | | | | | invalid. The LHS was already being corrected before being set to ExprError when the RHS is invalid, but when it was present the middle of a ternary expression would be dropped in the error paths. Fixes PR23350. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236347 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose delayed typos in an expr list that is in an invalid expression.Kaelyn Takata2015-03-271-0/+5
| | | | | | | | | | Previously, if the expr list parsed fine but the expr to the left of the open parenthesis was invalid (when parsing the suffix of a postfix-expression), the parsed expr list was just ignored. Fixes PR23005. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233347 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert a change from r222797 that is no longer needed and can causeKaelyn Takata2015-01-281-0/+8
| | | | | | | | | | | | | infinite recursion. Also guard against said infinite recursion by adding an assert that will trigger if CorrectDelayedTyposInExpr is called before a previous call to CorrectDelayedTyposInExpr returns (i.e. if the TreeTransform run by CorrectDelayedTyposInExpr calls a sequence of methods that end up calling CorrectDelayedTyposInExpr, as the new test case had done prior to this commit). Fixes PR22292. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227368 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a think-o in handling ambiguous corrections for a TypoExpr.Kaelyn Takata2015-01-271-0/+10
| | | | | | | | | | | | | | | | | | | | Under certain circumstances, the identifier mentioned in the diagnostic won't match the intended correction even though the replacement expression and the note pointing to the decl are both correct. Basically, the TreeTransform assumes the TypoExpr's Consumer points to the correct TypoCorrection, but the handling of typos that appear to be ambiguous from the point of view of TransformTypoExpr would cause that assumption to be violated by altering the Consumer's correction stream. This fix allows the Consumer's correction stream to be reset to the right TypoCorrection after successfully resolving the percieved ambiguity. Included is a fix to suppress correcting the RHS of an assignment to the LHS of that assignment for non-C++ code, to prevent a regression in test/SemaObjC/provisional-ivar-lookup.m. This fixes PR22297. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227251 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct all typos in the initialization arguments, even if one could notKaelyn Takata2015-01-211-0/+8
| | | | | | | | | | be corrected. This fixes PR22250, which exposed the bug where if there's more than one TypoExpr in the arguments, once one failed to be corrected none of the TypoExprs after it would be handled at all thanks to an early return. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226624 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a case where delayed typo correction should have resolved anKaelyn Takata2015-01-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226334 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle OpaqueValueExprs more intelligently in the TransformTypos treeKaelyn Takata2015-01-071-0/+5
| | | | | | | | | | | | transform. Also diagnose typos in the initializer of an invalid C++ declaration. Both issues were hit using the same line of test code, depending on whether the code was treated as C or C++. Fixes PR22092. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225389 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct delayed typos in the operand to typeof expressions.Kaelyn Takata2014-12-191-0/+5
| | | | | | Fixes PR21947. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224558 91177308-0d34-0410-b5e6-96231b3b80d8
* Try typo correction on all initialization arguments and be lessKaelyn Takata2014-12-161-0/+4
| | | | | | | | | pessimistic about when to do so. This also fixes PR21905 as the initialization argument was no longer viewed as being type dependent due to the TypoExpr being type-cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224386 91177308-0d34-0410-b5e6-96231b3b80d8
* Look at whether TransformTypos returned a different Expr instead of looking ↵Nick Lewycky2014-12-161-0/+13
| | | | | | | | | at the number of uncorrected typos before and after. Correcting one typo may produce an expression with another TypoExpr in it, leading to matching counts even though a typo was corrected. Fixes PR21925! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224380 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement feedback on r224172 in PR21899Reid Kleckner2014-12-131-14/+5
| | | | | | Based on suggestions from Kaelyn. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224173 91177308-0d34-0410-b5e6-96231b3b80d8
* Typo correction: Ignore temporary binding exprs after overload resolutionReid Kleckner2014-12-131-0/+20
| | | | | | | | Transformation of a CallExpr doesn't always result in a new CallExpr. Fixes PR21899. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224172 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle possible TypoExprs in member initializers.Kaelyn Takata2014-12-081-0/+7
| | | | | | | Includes a new test case since none of the existing tests were hitting this code path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223705 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle delayed corrections in a couple more error paths in ↵Kaelyn Takata2014-12-031-0/+6
| | | | | | ParsePostfixExpressionSuffix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223209 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure typos in the default values of template parameters get diagnosed.Kaelyn Takata2014-12-021-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223177 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure that any TypoExprs in the arguments to bultins with custom typeKaelyn Takata2014-11-251-0/+9
| | | | | | | | checking are handled before the custom type checking is performed. Fixes PR21669. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222797 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly correct initializer expressions based on whether they would be valid.Kaelyn Takata2014-11-211-0/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222550 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the full-Expr filter to disambiguate equidistant correctionKaelyn Takata2014-11-211-0/+11
| | | | | | candidates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222549 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure all TypoExprs are diagnosed by the tree transform.Kaelyn Takata2014-11-201-0/+6
| | | | | | | | | | | | If there is more than one TypoExpr within the expr being transformed and any but the last TypoExpr seen don't have any viable candidates, the tree transform will be aborted early and the remaining TypoExprs are never seen and hence never diagnosed. This adds a simple RecursiveASTVisitor to find all of the TypoExprs to be diagnosed in the case where typo correction of the entire expr fails (and the result of the tree transform is an ExprError). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222465 91177308-0d34-0410-b5e6-96231b3b80d8
* Wire up LookupMemberExpr to use the new TypoExpr.Kaelyn Takata2014-10-271-0/+44
This includes adding the new TypoExpr-based lazy typo correction to LookupMemberExprInRecord as an alternative to the existing eager typo correction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220698 91177308-0d34-0410-b5e6-96231b3b80d8