llvm.org GIT mirror llvm / e37b898
Remember if lseek works in this FD. It will be used in clang in a sec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234619 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 6 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
332332
333333 uint64_t pos;
334334
335 bool SupportsSeeking;
336
335337 /// See raw_ostream::write_impl.
336338 void write_impl(const char *Ptr, size_t Size) override;
337339
369371 /// fsync.
370372 void close();
371373
374 bool supportsSeeking() { return SupportsSeeking; }
375
372376 /// Flushes the stream and repositions the underlying file descriptor position
373377 /// to the offset specified from the beginning of the file.
374378 uint64_t seek(uint64_t off);
524524
525525 // Get the starting position.
526526 off_t loc = ::lseek(FD, 0, SEEK_CUR);
527 if (loc == (off_t)-1)
527 SupportsSeeking = loc != (off_t)-1;
528 if (!SupportsSeeking)
528529 pos = 0;
529530 else
530531 pos = static_cast(loc);