-/// isStandardOutAConsole - Return true if we can tell that the standard output
-/// stream goes to a terminal window or console.
-bool llvm::isStandardOutAConsole() {
-#if HAVE_ISATTY
- return isatty(1);
-#endif
- // If we don't have isatty, just return false.
+bool llvm::CheckBitcodeOutputToConsole(std::ostream* stream_to_check,
+ bool print_warning) {
+ if (stream_to_check == cout.stream() &&
+ sys::Process::StandardOutIsDisplayed()) {
+ if (print_warning) {
+ cerr << "WARNING: You're attempting to print out a bitcode file.\n"
+ << "This is inadvisable as it may cause display problems. If\n"
+ << "you REALLY want to taste LLVM bitcode first-hand, you\n"
+ << "can force output with the `-f' option.\n\n";
+ }
+ return true;
+ }