Make File option flags consistent for Python API

Summary:
Fixes SBCommandReturnObject::SetImmediateOutputFile() and
SBCommandReturnObject::SetImmediateOutputFile() for files opened
with "a" or "a+" by resolving inconsistencies between File and
our Python parsing of file objects.

Reviewers: granata.enrico, Eugene.Zelenko, jingham, clayborg

Subscribers: lldb-commits, sas

Differential Revision: http://reviews.llvm.org/D18228

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 264351
This commit is contained in:
Stephane Sezer
2016-03-24 22:22:20 +00:00
parent ce7c6cfe0e
commit c5273d929f
3 changed files with 46 additions and 3 deletions

View File

@@ -1253,10 +1253,10 @@ PythonFile::GetOptionsFromMode(llvm::StringRef mode)
return llvm::StringSwitch<uint32_t>(mode.str().c_str())
.Case("r", File::eOpenOptionRead)
.Case("w", File::eOpenOptionWrite)
.Case("a", File::eOpenOptionAppend|File::eOpenOptionCanCreate)
.Case("a", File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
.Case("r+", File::eOpenOptionRead|File::eOpenOptionWrite)
.Case("w+", File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate|File::eOpenOptionTruncate)
.Case("a+", File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionCanCreate)
.Case("a+", File::eOpenOptionRead|File::eOpenOptionWrite|File::eOpenOptionAppend|File::eOpenOptionCanCreate)
.Default(0);
}