[cfe-commits] Add typo correction for the (non-template) type name in C++ "new" statements. (issue 5014044)

chandlerc at gmail.com chandlerc at gmail.com
Fri Sep 23 10:58:54 PDT 2011


I don't really like all the plumbing of bool parameters through so much
of the parser.

Why don't we *always* want typo correction when we call
TryAnnotateTypeOrScopeToken? If there are good reasons, why can we not
detect it from the immediate context?

I looked at a few other calls, and didn't see any reason why we'd want
to skip typo correction, but I didn't look at all of them. I think this
really does need someone more deeply familiar with name lookup in the
parser to look at it...


http://codereview.appspot.com/5014044/diff/1/include/clang/Parse/Parser.h
File include/clang/Parse/Parser.h (right):

http://codereview.appspot.com/5014044/diff/1/include/clang/Parse/Parser.h#newcode1316
include/clang/Parse/Parser.h:1316: bool
ParseCXXTypeSpecifierSeq(DeclSpec &DS, bool TryTypoCorrection=false);
spaces around =

http://codereview.appspot.com/5014044/diff/1/lib/Parse/ParseDecl.cpp
File lib/Parse/ParseDecl.cpp (right):

http://codereview.appspot.com/5014044/diff/1/lib/Parse/ParseDecl.cpp#newcode2241
lib/Parse/ParseDecl.cpp:2241: TemplateInfo, SuppressDeclarations,
TryTypoCorrection);
80-columns

http://codereview.appspot.com/5014044/diff/1/lib/Parse/ParseDecl.cpp#newcode2252
lib/Parse/ParseDecl.cpp:2252: TemplateInfo, SuppressDeclarations,
TryTypoCorrection);
80-columns

http://codereview.appspot.com/5014044/diff/1/lib/Parse/Parser.cpp
File lib/Parse/Parser.cpp (right):

http://codereview.appspot.com/5014044/diff/1/lib/Parse/Parser.cpp#newcode1282
lib/Parse/Parser.cpp:1282: IdentifierInfo *CorrectedII = NULL;
s/NULL/0/

http://codereview.appspot.com/5014044/diff/1/lib/Parse/Parser.cpp#newcode1291
lib/Parse/Parser.cpp:1291: : NULL)) {
s/NULL/0/

http://codereview.appspot.com/5014044/diff/1/lib/Sema/SemaDecl.cpp
File lib/Sema/SemaDecl.cpp (right):

http://codereview.appspot.com/5014044/diff/1/lib/Sema/SemaDecl.cpp#newcode150
lib/Sema/SemaDecl.cpp:150: TypoCorrection Corr =
CorrectTypo(Result.getLookupNameInfo(),
Can we use a name better than 'Corr'?

http://codereview.appspot.com/5014044/diff/1/lib/Sema/SemaDecl.cpp#newcode165
lib/Sema/SemaDecl.cpp:165: std::string
CorrectedStr(Corr.getAsString(getLangOptions()));
Doesn't CorrecReplacement accept a StringRef? If so, can't we pass it a
StringRef without creating an additional string?

http://codereview.appspot.com/5014044/diff/1/lib/Sema/SemaDecl.cpp#newcode166
lib/Sema/SemaDecl.cpp:166: std::string
CorrectedQuotedStr(Corr.getQuoted(getLangOptions()));
Please stream the identifier info into the diagnostic. Formatting
decisions such as this should be made entirely based on the type of the
object being printed in the diagnostic and the diagnostic text in the
table.

http://codereview.appspot.com/5014044/



More information about the cfe-commits mailing list