summaryrefslogtreecommitdiff
path: root/tools/scan-build-py
diff options
context:
space:
mode:
authorAnton Yartsev <anton.yartsev@gmail.com>2016-02-21 17:04:26 +0000
committerAnton Yartsev <anton.yartsev@gmail.com>2016-02-21 17:04:26 +0000
commit8f351cf9bd30e6c8bc2577ff85410ed557ca1b51 (patch)
treea44349af57c5d578f9a5cb165a6d1efc8aae8189 /tools/scan-build-py
parentb9019e85ee592ec6f023093f43a1bcdf34dfa691 (diff)
downloadclang-8f351cf9bd30e6c8bc2577ff85410ed557ca1b51.tar.gz
[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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/scan-build-py')
-rw-r--r--tools/scan-build-py/libscanbuild/report.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/scan-build-py/libscanbuild/report.py b/tools/scan-build-py/libscanbuild/report.py
index efc0a55de6..5c33319e20 100644
--- a/tools/scan-build-py/libscanbuild/report.py
+++ b/tools/scan-build-py/libscanbuild/report.py
@@ -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)