[PATCH] D129642: [Sema] Tweak diagnostic logic so suppress-in-hedaer logic works in tools too.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 14 03:15:19 PDT 2022
kadircet accepted this revision.
kadircet added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:1784
if (D->isInvalidDecl() || D->isUsed() || D->hasAttr<UnusedAttr>())
return false;
----------------
sammccall wrote:
> kadircet wrote:
> > i think we can just bail out early here when the main file is a header file (i.e. lang opts have `IsHeaderFile` set).
> This makes sense.
>
> I'd rather do this as a separate commit in case we need to revert.
> This one is a functional change the IsHeaderFile check to a place that's already testing for header-like contexts.
> The other would be a (hopefully) NFC for performance.
>
> (This function isn't terribly hot in the clangd profiles I have, but seems like a reasonable change to me anyway)
SG. i was actually worried about the behaviour implied by the name "isMainFileLoc". i feel like both `TU_Complete` and `IsHeaderFile` check should actually happen here (or at least outside of the `isMainFileLoc`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129642/new/
https://reviews.llvm.org/D129642
More information about the cfe-commits
mailing list