Skip to content

Commit 1bd061b

Browse files
committed
[llvm] Add LLVM_CTOR_NODISCARD to WithColor
Similarly to WithMarkup, add LLVM_CTOR_NODISCARD to the WithColor constructor. (cherry picked from commit 511b4dd)
1 parent 29908a1 commit 1bd061b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/include/llvm/Support/WithColor.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_SUPPORT_WITHCOLOR_H
1010
#define LLVM_SUPPORT_WITHCOLOR_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "llvm/Support/raw_ostream.h"
1314

1415
namespace llvm {
@@ -58,19 +59,18 @@ class WithColor {
5859
/// @param OS The output stream
5960
/// @param S Symbolic name for syntax element to color
6061
/// @param Mode Enable, disable or compute whether to use colors.
61-
WithColor(raw_ostream &OS, HighlightColor S,
62-
ColorMode Mode = ColorMode::Auto);
62+
LLVM_CTOR_NODISCARD WithColor(raw_ostream &OS, HighlightColor S,
63+
ColorMode Mode = ColorMode::Auto);
6364
/// To be used like this: WithColor(OS, raw_ostream::BLACK) << "text";
6465
/// @param OS The output stream
6566
/// @param Color ANSI color to use, the special SAVEDCOLOR can be used to
6667
/// change only the bold attribute, and keep colors untouched
6768
/// @param Bold Bold/brighter text, default false
6869
/// @param BG If true, change the background, default: change foreground
6970
/// @param Mode Enable, disable or compute whether to use colors.
70-
WithColor(raw_ostream &OS,
71-
raw_ostream::Colors Color = raw_ostream::SAVEDCOLOR,
72-
bool Bold = false, bool BG = false,
73-
ColorMode Mode = ColorMode::Auto)
71+
LLVM_CTOR_NODISCARD WithColor(
72+
raw_ostream &OS, raw_ostream::Colors Color = raw_ostream::SAVEDCOLOR,
73+
bool Bold = false, bool BG = false, ColorMode Mode = ColorMode::Auto)
7474
: OS(OS), Mode(Mode) {
7575
changeColor(Color, Bold, BG);
7676
}

0 commit comments

Comments
 (0)