xref: /freebsd/contrib/llvm-project/llvm/lib/Support/SystemUtils.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===- SystemUtils.cpp - Utilities for low-level system tasks -------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric // This file contains functions used to do a variety of low-level, often
10*0b57cec5SDimitry Andric // system-specific, tasks.
11*0b57cec5SDimitry Andric //
12*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric #include "llvm/Support/SystemUtils.h"
15*0b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
16*0b57cec5SDimitry Andric using namespace llvm;
17*0b57cec5SDimitry Andric 
18*0b57cec5SDimitry Andric bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check,
19*0b57cec5SDimitry Andric                                        bool print_warning) {
20*0b57cec5SDimitry Andric   if (stream_to_check.is_displayed()) {
21*0b57cec5SDimitry Andric     if (print_warning) {
22*0b57cec5SDimitry Andric       errs() << "WARNING: You're attempting to print out a bitcode file.\n"
23*0b57cec5SDimitry Andric                 "This is inadvisable as it may cause display problems. If\n"
24*0b57cec5SDimitry Andric                 "you REALLY want to taste LLVM bitcode first-hand, you\n"
25*0b57cec5SDimitry Andric                 "can force output with the `-f' option.\n\n";
26*0b57cec5SDimitry Andric     }
27*0b57cec5SDimitry Andric     return true;
28*0b57cec5SDimitry Andric   }
29*0b57cec5SDimitry Andric   return false;
30*0b57cec5SDimitry Andric }
31