Skip to content

Commit 932d88c

Browse files
committedNov 11, 2015
[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
1 parent d932679 commit 932d88c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎clang/tools/scan-build/scan-build

+3-1
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,9 @@ sub ProcessArgs {
14781478

14791479
# Construct an absolute path. Uses the current working directory
14801480
# as a base if the original path was not absolute.
1481-
$Options{OutputDir} = abs_path(shift @$Args);
1481+
my $OutDir = shift @$Args;
1482+
mkpath($OutDir) unless (-e $OutDir); # abs_path wants existing dir
1483+
$Options{OutputDir} = abs_path($OutDir);
14821484

14831485
next;
14841486
}

0 commit comments

Comments
 (0)
Please sign in to comment.