abrahamcd added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp:177-178
+      diag(NonMemberLoc, "ignoring the result of '%0', did you mean 
'clear()'?")
+          << llvm::dyn_cast<NamedDecl>(NonMemberCall->getCalleeDecl())
+                 ->getQualifiedNameAsString()
+          << FixItHint::CreateReplacement(ReplacementRange, ReplacementText);
----------------
njames93 wrote:
> Diagnostics can accept args as `const NamedDecl *`, so you can omit the call 
> to `getQualifiedNameAsString()`.
> The use of `dyn_cast` here is suspicious. If the CalleeDecl isn't a 
> `NamedDecl`, this would assert when you try and call 
> `getQualifiedNameAsString`, but equally I can't see any case why the 
> CalleeDecl wouldn't be a `NamedDecl`. @rsmith Can you think of any situation 
> where this could happen?
Seems that without `getQualifiedNameAsString()` I get longer less-readable 
versions of the name, e.g. `'empty<std::vector<int> &>'` instead of just 
`'std::empty'`. Do you think the extra information is helpful here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128372/new/

https://reviews.llvm.org/D128372

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to