1# DExTer : Debugging Experience Tester
2# ~~~~~~   ~         ~~         ~   ~~
3#
4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5# See https://llvm.org/LICENSE.txt for license information.
6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7"""Utility functions for producing command line warnings."""
8
9
10def warn(context, msg, flag=None):
11    if context.options.no_warnings:
12        return
13
14    msg = msg.rstrip()
15    if flag:
16        msg = '{} <y>[{}]</>'.format(msg, flag)
17
18    context.o.auto('warning: <d>{}</>\n'.format(msg))
19