[PATCH] D17091: [analyzer][scan-build-py] Non-existing directory for scan-build output.

Anton Yartsev via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 12:45:43 PST 2016


ayartsev created this revision.
ayartsev added a reviewer: rizsotto.mailinglist.
ayartsev added a subscriber: cfe-commits.

Attached patch 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. Please review.

http://reviews.llvm.org/D17091

Files:
  tools/scan-build-py/libscanbuild/report.py

Index: tools/scan-build-py/libscanbuild/report.py
===================================================================
--- tools/scan-build-py/libscanbuild/report.py
+++ tools/scan-build-py/libscanbuild/report.py
@@ -35,7 +35,12 @@
     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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17091.47505.patch
Type: text/x-patch
Size: 674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160210/0b0d04ea/attachment.bin>


More information about the cfe-commits mailing list