Oops, one more comment.

+  unsigned CorrectedParamIndex = ParamCommandComment::InvalidParamIndex;
+  if (FD->param_size() == 1) {
+    // If function has only one parameter then only that parameter
+    // can be documented.
+    CorrectedParamIndex = 0;
+  } else {
+    // Do typo correction.
+    CorrectedParamIndex = correctTypoInParmVarReference(Arg, FD);
+  }
+  if (CorrectedParamIndex != ParamCommandComment::InvalidParamIndex) {
+    const ParmVarDecl *CorrectedPVD = FD->getParamDecl(CorrectedParamIndex);
+    if (const IdentifierInfo *CorrectedII = CorrectedPVD->getIdentifier())
+      Diag(ArgLocBegin, diag::note_doc_param_name_suggestion)
+        << CorrectedII->getName()
+        << FixItHint::CreateReplacement(ArgRange, CorrectedII->getName());
+  }

The most common mistake I make when writing \param documentation is actually to 
leave out the name of the parameter, particularly when the function only has 
one parameter. I can't actually think of a way to catch this easily, but it 
makes me more wary of the one-parameter correction case. Then again, the 
fixit's on a note, so I guess it's not too bad.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to