[PATCH] D44295: [clang-tidy] Detects and fixes calls to grand-...parent virtual methods instead of calls to parent's virtual methods

Zinovy Nis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 18 10:35:27 PDT 2018


zinovy.nis marked 6 inline comments as done.
zinovy.nis added inline comments.


================
Comment at: clang-tidy/bugprone/ParentVirtualCallCheck.cpp:128
+      diag(Member->getQualifierLoc().getSourceRange().getBegin(),
+           "'%0' is a grand-parent's method, not parent's. Did you mean %1?")
+      << CalleeName << ParentsStr;
----------------
aaron.ballman wrote:
> zinovy.nis wrote:
> > aaron.ballman wrote:
> > > The diagnostic should not contain punctuation aside from the question mark.
> > > 
> > > Also, the diagnostic uses some novel terminology in "grandparent's method". How about: "qualified function name %0 refers to a function that is not defined by a direct base class; did you mean %1?"
> > "is not defined by a direct base class" is not a correct proposal. Issues that this check finds are all about calling a grand-parent's method instead of parent's whether base class defines this method or not.
> > 
> > How about 
> > 
> > > Qualified function name %0 refers to a function not from a direct base class; did you mean %1?
> > 
> > ?
> Not keen on "from", but we could use `"qualified function name %q0 refers to a function that is not explicitly declared by a direct base class; did you mean %1?"`
Changed to  

> qualified name %0 refers to a member which was overridden in subclass%1"




Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44295





More information about the cfe-commits mailing list