[llvm] r340588 - Make LLVM_ENABLE_CRASH_DUMPS set a variable default

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 15:58:56 PDT 2018


Author: rnk
Date: Thu Aug 23 15:58:56 2018
New Revision: 340588

URL: http://llvm.org/viewvc/llvm-project?rev=340588&view=rev
Log:
Make LLVM_ENABLE_CRASH_DUMPS set a variable default

That way users can set the default to true, but then disable core dumps
from certain apps that link support.

Modified:
    llvm/trunk/lib/Support/Process.cpp

Modified: llvm/trunk/lib/Support/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Process.cpp?rev=340588&r1=340587&r2=340588&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Process.cpp (original)
+++ llvm/trunk/lib/Support/Process.cpp Thu Aug 23 15:58:56 2018
@@ -83,12 +83,11 @@ static const char colorcodes[2][2][8][10
  { ALLCOLORS("4",""), ALLCOLORS("4","1;") }
 };
 
-// This is set to true when Process::PreventCoreFiles() is called.
-static bool coreFilesPrevented = false;
+// A CMake option controls wheter we emit core dumps by default. An application
+// may disable core dumps by calling Process::PreventCoreFiles().
+static bool coreFilesPrevented = !LLVM_ENABLE_CRASH_DUMPS;
 
-bool Process::AreCoreFilesPrevented() {
-  return LLVM_ENABLE_CRASH_DUMPS ? coreFilesPrevented : false;
-}
+bool Process::AreCoreFilesPrevented() { return coreFilesPrevented; }
 
 // Include the platform-specific parts of this class.
 #ifdef LLVM_ON_UNIX




More information about the llvm-commits mailing list