diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2015-11-11 20:39:03 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2015-11-11 20:39:03 +0000 |
commit | 932d88ca051787a2db9e8bcd06a09100c03980cd (patch) | |
tree | fe562f46d1c969a84c01c0926eb24ca26d852617 | |
parent | d932679c71c0a650c0afa109d4fdcbbe0e48877b (diff) | |
download | bcm5719-llvm-932d88ca051787a2db9e8bcd06a09100c03980cd.tar.gz bcm5719-llvm-932d88ca051787a2db9e8bcd06a09100c03980cd.zip |
[analyzer] Fix scan-build to handle missing output directories.
Cwd::abs_path has a somewhat tricky semantics: if it's operand directory does not exist,
it'll return undefined (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257568).
This may cause scan-build to silently ignore output directory (specified with -o) and
use /tmp instead of trying to create directory. This tiny patch fixes the problem.
A patch by Yury Gribov!
Differential Revision: http://reviews.llvm.org/D14535
llvm-svn: 252797
-rwxr-xr-x | clang/tools/scan-build/scan-build | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/tools/scan-build/scan-build b/clang/tools/scan-build/scan-build index 65dc4fe1fa3..be6056ccb9d 100755 --- a/clang/tools/scan-build/scan-build +++ b/clang/tools/scan-build/scan-build @@ -1478,7 +1478,9 @@ sub ProcessArgs { # Construct an absolute path. Uses the current working directory # as a base if the original path was not absolute. - $Options{OutputDir} = abs_path(shift @$Args); + my $OutDir = shift @$Args; + mkpath($OutDir) unless (-e $OutDir); # abs_path wants existing dir + $Options{OutputDir} = abs_path($OutDir); next; } |