[Lldb-commits] [lldb] r334221 - [FileSystem] Split up the OpenFlags enumeration.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 7 12:58:58 PDT 2018

Author: zturner
Date: Thu Jun  7 12:58:58 2018
New Revision: 334221

URL: http://llvm.org/viewvc/llvm-project?rev=334221&view=rev
[FileSystem] Split up the OpenFlags enumeration.

This breaks the OpenFlags enumeration into two separate
enumerations: OpenFlags and CreationDisposition.  The first
controls the behavior of the API depending on whether or not
the target file already exists, and is not a flags-based
enum.  The second controls more flags-like values.

This yields a more easy to understand API, while also allowing
flags to be passed to the openForRead api, where most of the
values didn't make sense before.  This also makes the apis more
testable as it becomes easy to enumerate all the configurations
which make sense, so I've added many new tests to exercise all
the different values.


Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=334221&r1=334220&r2=334221&view=diff
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Jun  7 12:58:58 2018
@@ -1241,8 +1241,8 @@ bool Debugger::EnableLog(llvm::StringRef
       if (log_options & LLDB_LOG_OPTION_APPEND)
         flags |= llvm::sys::fs::F_Append;
       int FD;
-      if (std::error_code ec =
-              llvm::sys::fs::openFileForWrite(log_file, FD, flags)) {
+      if (std::error_code ec = llvm::sys::fs::openFileForWrite(
+              log_file, FD, llvm::sys::fs::CD_CreateAlways, flags)) {
         error_stream << "Unable to open log file: " << ec.message();
         return false;

More information about the lldb-commits mailing list