[clang] [clang] Extend -Wunused-but-set-variable to static globals (PR #178342)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 09:48:44 PDT 2026
================
@@ -1900,12 +1900,10 @@ bool Sema::mightHaveNonExternalLinkage(const DeclaratorDecl *D) {
return !D->isExternallyVisible();
}
-// FIXME: This needs to be refactored; some other isInMainFile users want
-// these semantics.
-static bool isMainFileLoc(const Sema &S, SourceLocation Loc) {
- if (S.TUKind != TU_Complete || S.getLangOpts().IsHeaderFile)
+bool Sema::isMainFileLoc(SourceLocation Loc) const {
----------------
zwuis wrote:
IMO this definition should be put in Sema.cpp because it can be used for other kinds of semantic analysis.
The declaration of `isMainFileLoc` might be moved because declarations in Sema.h are grouped by files where they are implemented.
https://github.com/llvm/llvm-project/pull/178342
More information about the cfe-commits
mailing list