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 | d889d2461f0e5f66e3936069ba4e03be451c23f1 (patch) | |
tree | fb10b6307bcabbca478db2aef20132635477dce2 /clang/lib/Parse/Parser.cpp | |
parent | fd51520d5fce0d49d914626f18954aa2e736dbcf (diff) | |
download | bcm5719-llvm-d889d2461f0e5f66e3936069ba4e03be451c23f1.tar.gz bcm5719-llvm-d889d2461f0e5f66e3936069ba4e03be451c23f1.zip |
Add typo correction for the type name in C++ "new" statements
llvm-svn: 140589
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index dd6d527a66e..49928dc1d25 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/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); |