[all-commits] [llvm/llvm-project] 56e241: [analyzer] Unbreak [[clang::suppress]] on checkers...

Artem Dergachev via All-commits all-commits at lists.llvm.org
Wed Jan 31 13:55:44 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56e241a07ff7f839d39775dbf05de5153a8e7d9f
      https://github.com/llvm/llvm-project/commit/56e241a07ff7f839d39775dbf05de5153a8e7d9f
  Author: Artem Dergachev <adergachev at apple.com>
  Date:   2024-01-31 (Wed, 31 Jan 2024)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/BugReporter/BugSuppression.h
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    M clang/lib/StaticAnalyzer/Core/BugSuppression.cpp
    M clang/test/Analysis/Checkers/WebKit/call-args.cpp
    M clang/test/Analysis/copypaste/suspicious-clones.cpp

  Log Message:
  -----------
  [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (#79398)

There are currently a few checkers that don't fill in the bug report's
"decl-with-issue" field (typically a function in which the bug is
found).

The new attribute `[[clang::suppress]]` uses decl-with-issue to reduce
the size of the suppression source range map so that it didn't need to
do that for the entire translation unit.

I'm already seeing a few problems with this approach so I'll probably
redesign it in some point as it looks like a premature optimization. Not
only checkers shouldn't be required to pass decl-with-issue (consider
clang-tidy checkers that never had such notion), but also it's not
necessarily uniquely determined (consider leak suppressions at
allocation site).

For now I'm adding a simple stop-gap solution that falls back to
building the suppression map for the entire TU whenever decl-with-issue
isn't specified. Which won't happen in the default setup because luckily
all default checkers do provide decl-with-issue.

---------

Co-authored-by: Balazs Benics <benicsbalazs at gmail.com>




More information about the All-commits mailing list