r261480 - [analyzer][scan-build] Non-existing directory for scan-build output.

Anton Yartsev via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 21 09:04:26 PST 2016


Author: ayartsev
Date: Sun Feb 21 11:04:26 2016
New Revision: 261480

URL: http://llvm.org/viewvc/llvm-project?rev=261480&view=rev
Log:
[analyzer][scan-build] Non-existing directory for scan-build output.

Makes scan-build successfully accept non-existing output directories provided via "-o" option. The directory is created in this case. This behavior is conforming to the old perl scan-build implementation.
(http://reviews.llvm.org/D17091)

Modified:
    cfe/trunk/tools/scan-build-py/libscanbuild/report.py

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/report.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/report.py?rev=261480&r1=261479&r2=261480&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build-py/libscanbuild/report.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/report.py Sun Feb 21 11:04:26 2016
@@ -35,7 +35,12 @@ def report_directory(hint, keep):
     keep -- a boolean value to keep or delete the empty report directory. """
 
     stamp = time.strftime('scan-build-%Y-%m-%d-%H%M%S-', time.localtime())
-    name = tempfile.mkdtemp(prefix=stamp, dir=hint)
+
+    parentdir = os.path.abspath(hint)
+    if not os.path.exists(parentdir):
+        os.makedirs(parentdir)
+
+    name = tempfile.mkdtemp(prefix=stamp, dir=parentdir)
 
     logging.info('Report directory created: %s', name)
 




More information about the cfe-commits mailing list