[clang] a3d0b58 - [analyzer] Fix deprecated plistlib functions

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 1 08:08:20 PDT 2021


Author: Manas
Date: 2021-10-01T17:07:24+02:00
New Revision: a3d0b5805e5ff2fd870df5be5c3197eee0bb74a0

URL: https://github.com/llvm/llvm-project/commit/a3d0b5805e5ff2fd870df5be5c3197eee0bb74a0
DIFF: https://github.com/llvm/llvm-project/commit/a3d0b5805e5ff2fd870df5be5c3197eee0bb74a0.diff

LOG: [analyzer] Fix deprecated plistlib functions

It replaces the usage of readPlist,writePlist functions with load,dump
in plistlib package.

This fixes deprecation issues when analyzer reports are being generated
outside of docker.

Patch by Manas!

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D107312

Added: 
    

Modified: 
    clang/utils/analyzer/SATestBuild.py

Removed: 
    


################################################################################
diff  --git a/clang/utils/analyzer/SATestBuild.py b/clang/utils/analyzer/SATestBuild.py
index 1977a8fc2aeff..cf02f26ef267b 100644
--- a/clang/utils/analyzer/SATestBuild.py
+++ b/clang/utils/analyzer/SATestBuild.py
@@ -856,7 +856,8 @@ def normalize_reference_results(directory: str, output_dir: str,
                 continue
 
             plist = os.path.join(dir_path, filename)
-            data = plistlib.readPlist(plist)
+            with open(plist, "rb") as plist_file:
+                data = plistlib.load(plist_file)
             path_prefix = directory
 
             if build_mode == 1:
@@ -875,7 +876,8 @@ def normalize_reference_results(directory: str, output_dir: str,
             if 'clang_version' in data:
                 data.pop('clang_version')
 
-            plistlib.writePlist(data, plist)
+            with open(plist, "wb") as plist_file:
+                plistlib.dump(data, plist_file)
 
 
 def get_build_log_path(output_dir: str) -> str:


        


More information about the cfe-commits mailing list