[PATCH] D106739: [analyzer] Add option to SATest.py for extra checkers

Deep Majumder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 23 22:41:26 PDT 2021


RedDocMD created this revision.
RedDocMD added reviewers: vsavchenko, NoQ, xazax.hun, teemperor.
Herald added subscribers: manas, steakhal, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
RedDocMD requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds the flag `extra-checkers` to the sub-command `build` for
passing a comma separated list of additional checkers to include.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106739

Files:
  clang/utils/analyzer/SATest.py
  clang/utils/analyzer/SATestBuild.py


Index: clang/utils/analyzer/SATestBuild.py
===================================================================
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -213,6 +213,7 @@
     project: ProjectInfo
     override_compiler: bool = False
     extra_analyzer_config: str = ""
+    extra_checkers: str = ""
     is_reference_build: bool = False
     strictness: int = 0
 
@@ -233,13 +234,16 @@
     """
     A component aggregating all of the project testing.
     """
+
     def __init__(self, jobs: int, projects: List[ProjectInfo],
                  override_compiler: bool, extra_analyzer_config: str,
+                 extra_checkers: str,
                  regenerate: bool, strictness: bool):
         self.jobs = jobs
         self.projects = projects
         self.override_compiler = override_compiler
         self.extra_analyzer_config = extra_analyzer_config
+        self.extra_checkers = extra_checkers
         self.regenerate = regenerate
         self.strictness = strictness
 
@@ -252,6 +256,7 @@
                 TestInfo(project,
                          self.override_compiler,
                          self.extra_analyzer_config,
+                         self.extra_checkers,
                          self.regenerate, self.strictness))
         if self.jobs <= 1:
             return self._single_threaded_test_all(projects_to_test)
@@ -305,10 +310,12 @@
     """
     A component aggregating testing for one project.
     """
+
     def __init__(self, test_info: TestInfo, silent: bool = False):
         self.project = test_info.project
         self.override_compiler = test_info.override_compiler
         self.extra_analyzer_config = test_info.extra_analyzer_config
+        self.extra_checkers = test_info.extra_checkers
         self.is_reference_build = test_info.is_reference_build
         self.strictness = test_info.strictness
         self.silent = silent
@@ -414,6 +421,8 @@
         if 'SA_ADDITIONAL_CHECKERS' in os.environ:
             all_checkers = (all_checkers + ',' +
                             os.environ['SA_ADDITIONAL_CHECKERS'])
+        if self.extra_checkers != "":
+            all_checkers += "," + self.extra_checkers
 
         # Run scan-build from within the patched source directory.
         cwd = os.path.join(directory, PATCHED_SOURCE_DIR_NAME)
Index: clang/utils/analyzer/SATest.py
===================================================================
--- clang/utils/analyzer/SATest.py
+++ clang/utils/analyzer/SATest.py
@@ -42,6 +42,7 @@
                                           projects,
                                           args.override_compiler,
                                           args.extra_analyzer_config,
+                                          args.extra_checkers,
                                           args.regenerate,
                                           args.strictness)
     tests_passed = tester.test_all()
@@ -250,6 +251,10 @@
                               dest="extra_analyzer_config", type=str,
                               default="",
                               help="Arguments passed to to -analyzer-config")
+    build_parser.add_argument("--extra-checkers",
+                              dest="extra_checkers", type=str,
+                              default="",
+                              help="Extra checkers to enable")
     build_parser.add_argument("--projects", action="store", default="",
                               help="Comma-separated list of projects to test")
     build_parser.add_argument("--max-size", action="store", default=None,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106739.361413.patch
Type: text/x-patch
Size: 3618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210724/810be9bc/attachment-0001.bin>


More information about the cfe-commits mailing list