[PATCH] D86406: Speedup llvm-dwarfdump 3.9x
Jan Kratochvil via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 11:31:32 PDT 2020
jankratochvil updated this revision to Diff 287723.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86406/new/
https://reviews.llvm.org/D86406
Files:
llvm/include/llvm/Support/raw_ostream.h
llvm/lib/Support/raw_ostream.cpp
Index: llvm/lib/Support/raw_ostream.cpp
===================================================================
--- llvm/lib/Support/raw_ostream.cpp
+++ llvm/lib/Support/raw_ostream.cpp
@@ -858,7 +858,9 @@
}
bool raw_fd_ostream::has_colors() const {
- return sys::Process::FileDescriptorHasColors(FD);
+ if (!HasColors)
+ HasColors = sys::Process::FileDescriptorHasColors(FD);
+ return *HasColors;
}
Expected<sys::fs::FileLocker> raw_fd_ostream::lock() {
Index: llvm/include/llvm/Support/raw_ostream.h
===================================================================
--- llvm/include/llvm/Support/raw_ostream.h
+++ llvm/include/llvm/Support/raw_ostream.h
@@ -412,6 +412,7 @@
int FD;
bool ShouldClose;
bool SupportsSeeking = false;
+ mutable Optional<bool> HasColors;
#ifdef _WIN32
/// True if this fd refers to a Windows console device. Mintty and other
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86406.287723.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200825/09169135/attachment.bin>
More information about the llvm-commits
mailing list