[PATCH] D108560: [clang-tidy] Add support for `NOLINTBEGIN` ... `NOLINTEND` comments
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 10 05:38:54 PST 2021
Sounds good to me. Thanks for pushing on this!
On Wed, Dec 8, 2021 at 4:47 AM Salman Javed via Phabricator <
reviews at reviews.llvm.org> wrote:
> salman-javed-nz added a comment.
>
> Hi, just giving a progress update. This is just a early heads-up - no
> action needed from you at this stage.
>
> I have a rough prototype that seems promising. The big-O/time complexity
> is no longer dependent on the number of headers being included and the
> number of diagnostics being raised. I need to tidy up and refactor the code
> before sharing with you but to give an early indication of the path I'm
> taking, it's essentially:
>
> struct NolintBlock {
> SourceLocation BeginLoc;
> SourceLocation EndLoc;
> std::string Checks;
> };
>
> // Need to keep a cache of every NOLINT block seen, not only in the
> current file
> // but in any other file seen during this run of the program. We may be
> context
> // switching between files (if there is a check violation in a macro in
> an
> // #included file, for instance), and we don't want to be starting from
> scratch
> // each time.
> some_kind_of_map<FileID, SmallVector<NolintBlock>> NolintBlocks;
> // Performance of each type of map class is still to be evaluated...
>
> bool lineIsMarkedWithNOLINT(/* ... */) {
> // These two `if` statements will more or less be the same as they are
> now:
> // If NOLINT statement found on this line, return true
> // If NOLINTNEXTLINE statement found on previous line, return true
>
> // If no cache for the file exists, generate it (warning: heavy
> operation)
>
> // For NolintBlock in NolintBlocks[FileID]:
> // if NolintBlock.StartLoc < Loc < NolintBlock.EndLoc:
> // return true
> // Return false
> }
>
>
> Repository:
> rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D108560/new/
>
> https://reviews.llvm.org/D108560
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211210/c7c5fc6a/attachment.html>
More information about the cfe-commits
mailing list