On Mac OS X, use TMPDIR as the default location to place analysis results.  This is a more secure location for such files, and addresses <rdar://problem/6334220>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58491 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/scan-build b/utils/scan-build
index dbdb240..4ad8a74 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -137,7 +137,14 @@
     
   my $TmpMode = 0;
   if (!defined $Dir) {
-    $Dir = "/tmp";
+    if (`uname` =~ /Darwin/) {
+      $Dir = $ENV{'TMPDIR'};
+      if (!defined $Dir) { $Dir = "/tmp"; }
+    }
+    else {
+      $Dir = "/tmp";
+    }
+    
     $TmpMode = 1;
   }
 
@@ -848,7 +855,7 @@
  -o             - Target directory for HTML report files.  Subdirectories
                   will be created as needed to represent separate "runs" of
                   the analyzer.  If this option is not specified, a directory
-                  is created in /tmp to store the reports.
+                  is created in /tmp (TMPDIR on Mac OS X) to store the reports.
 
  -h             - Display this message.
  --help