[PATCH] Replace PrintStackTrace(FILE*) with PrintStackTrace(raw_ostream&)
Zachary Turner
zturner at google.com
Wed Mar 4 23:07:52 PST 2015
Hi samsonov, rnk, chandlerc,
A FILE* method isn't as useful as an overload that takes an llvm::raw_ostream&. This way we can use raw_fd_ostream if we want the old behavior, or more commonly just llvm::errs() if we want to write to stderr. Plus, this adds the flexibility necessary to save the results to a string if we want to tee them to a log file as well as stderr, for example.
Note: This patch is currently untested on Linux and Mac. There should be no functional change, but I need to at least compile on Linux / Mac to make sure it's not broken. I plan to do this tomorrow. I'm mostly looking for comments on the general idea, because I don't expect this to be too controversial.
There is only 1 existing callsite of the FILE* method, which is in clang/CIndex.cpp. It calls PrintStackTrace(stderr). I will fix this to use PrintStackTrace(llvm::errs()) in a separate patch.
http://reviews.llvm.org/D8074
Files:
include/llvm/Support/Signals.h
lib/Support/Unix/Signals.inc
lib/Support/Windows/Signals.inc
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8074.21258.patch
Type: text/x-patch
Size: 8622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150305/cdc9f332/attachment.bin>
More information about the llvm-commits
mailing list