[PATCH] D14535: [analyzer] Fix scan-build to handle missing output directories.

Yury Gribov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 02:51:01 PST 2015


ygribov created this revision.
ygribov added reviewers: zaks.anna, dcoughlin.
ygribov added a subscriber: llvm-commits.
ygribov set the repository for this revision to rL LLVM.

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.

Repository:
  rL LLVM

http://reviews.llvm.org/D14535

Files:
  tools/scan-build/scan-build

Index: tools/scan-build/scan-build
===================================================================
--- tools/scan-build/scan-build
+++ tools/scan-build/scan-build
@@ -1478,7 +1478,9 @@
 
       # 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;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14535.39799.patch
Type: text/x-patch
Size: 554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151110/7133dbb5/attachment.bin>


More information about the llvm-commits mailing list