[PATCH] D152707: [clang][Sema] Provide source range to several Wunused warnings

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 13 05:14:26 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LG aside from the few suggested changes and moving the header to the Inputs directory.



================
Comment at: clang/lib/Sema/Sema.cpp:1350
           continue; // Deleted functions are supposed to be unused.
+        SourceRange DiagRange = SourceRange(DiagD->getLocation());
+        if (const ASTTemplateArgumentListInfo *ASTTAL =
----------------
hazohelet wrote:
> aaron.ballman wrote:
> > Does `DiagD->getSourceRange()` not give you the same results?
> `FunctionDecl::getSourceRange` also covers the return type and the function body if it exists, so we cannot use it here.
Ah, okay, that makes sense. Thank you!

<not your problem>
I think we should consider adding `SourceRange` accessors for various interesting ranges like this so that we don't need to use ad hoc solutions in various places.
</not your problem>


================
Comment at: clang/test/Misc/diag-unused-source-ranges.h:1
+static void thing(void) {}
----------------
tbaeder wrote:
> Moving this file to `Inputs/` would make sense I think.
+1


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

https://reviews.llvm.org/D152707



More information about the cfe-commits mailing list