[cfe-commits] PATCH #1 for "[sema++] clang should give a fixit for */& mismatch"
John McCall
rjmccall at apple.com
Tue Jul 19 10:38:16 PDT 2011
On Jul 18, 2011, at 3:12 PM, Anna Zaks wrote:
> Attached is the updated patch. It includes the code review comments + sorting of the diagnostics based on the fixit info.
>
> (No test for objective C since it will not result in the error, but a warning coming from a different location in the code. I'll add these fix to more errors/warnings later on.)
+ /// The FixIt hints which can be used to fix the Bad candidate.
+ struct FixInfo {
+ /// The list of Hints (all have to be applied).
+ llvm::SmallVector<FixItHint, 4> Hints;
+
+ /// The number of Conversions fixed. This can be different from the size
+ /// of the Hints vector since we allow multiple FixIts per conversion.
+ unsigned NumConversionsFixed;
+
+ /// The type of fix applied.
+ OverloadFixItKind Kind;
+ } Fix;
This is a lot to be adding to every overload candidate. At the very least, Hints should have inline size 1, and maybe it should even just be a pointer to an array that's allocated on need.
+ // Only suggest taking address of L-values.
+ if (!Arg->isLValue())
+ return false;
This should also check that getObjectKind() == OK_Ordinary; otherwise we'll suggest taking the address of e.g. bitfields.
// TODO: specialize more based on the kind of mismatch
I think this TODO can go away now. :) Obviously there's always more that can be done, but this is a good first step.
Thanks!
John.
More information about the cfe-commits
mailing list