diff options
author | Kaelyn Uhrain <rikka@google.com> | 2011-09-27 00:33:13 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2011-09-27 00:33:13 +0000 |
commit | 93476ddd9ce490f9c08d78b640efad812cb019d1 (patch) | |
tree | 30aebc00753c07010f7eea77ef5226b69a00a990 /lib/Parse/Parser.cpp | |
parent | 671436e9e2794c56f3c2e62739d225571493af37 (diff) |
Add typo correction for the type name in C++ "new" statements
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r-- | lib/Parse/Parser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index dd6d527a66..49928dc1d2 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1278,13 +1278,18 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) { return true; if (Tok.is(tok::identifier)) { + IdentifierInfo *CorrectedII = 0; // Determine whether the identifier is a type name. if (ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), &SS, false, NextToken().is(tok::period), ParsedType(), - /*NonTrivialTypeSourceInfo*/true)) { + /*NonTrivialTypeSourceInfo*/true, + &CorrectedII)) { + // A FixIt was applied as a result of typo correction + if (CorrectedII) + Tok.setIdentifierInfo(CorrectedII); // This is a typename. Replace the current token in-place with an // annotation type token. Tok.setKind(tok::annot_typename); |