1919#include " llvm/TableGen/Record.h"
2020#include < cstdlib>
2121
22- namespace llvm {
22+ using namespace llvm ;
2323
24- SourceMgr SrcMgr;
25- unsigned ErrorsPrinted = 0 ;
24+ SourceMgr llvm:: SrcMgr;
25+ unsigned llvm:: ErrorsPrinted = 0 ;
2626
2727static void PrintMessage (ArrayRef<SMLoc> Locs, SourceMgr::DiagKind Kind,
2828 const Twine &Msg) {
@@ -49,118 +49,118 @@ static void PrintMessage(ArrayRef<SMLoc> Locs, SourceMgr::DiagKind Kind,
4949
5050// Functions to print notes.
5151
52- void PrintNote (const Twine &Msg) {
53- WithColor::note () << Msg << " \n " ;
54- }
52+ void llvm::PrintNote (const Twine &Msg) { WithColor::note () << Msg << " \n " ; }
5553
56- void PrintNote (function_ref<void (raw_ostream &OS)> PrintMsg) {
54+ void llvm:: PrintNote (function_ref<void (raw_ostream &OS)> PrintMsg) {
5755 PrintMsg (WithColor::note ());
5856}
5957
60- void PrintNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
58+ void llvm:: PrintNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
6159 PrintMessage (NoteLoc, SourceMgr::DK_Note, Msg);
6260}
6361
6462// Functions to print fatal notes.
6563
66- void PrintFatalNote (const Twine &Msg) {
64+ void llvm:: PrintFatalNote (const Twine &Msg) {
6765 PrintNote (Msg);
6866 fatal_exit ();
6967}
7068
71- void PrintFatalNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
69+ void llvm:: PrintFatalNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
7270 PrintNote (NoteLoc, Msg);
7371 fatal_exit ();
7472}
7573
7674// This method takes a Record and uses the source location
7775// stored in it.
78- void PrintFatalNote (const Record *Rec, const Twine &Msg) {
76+ void llvm:: PrintFatalNote (const Record *Rec, const Twine &Msg) {
7977 PrintNote (Rec->getLoc (), Msg);
8078 fatal_exit ();
8179}
8280
8381// This method takes a RecordVal and uses the source location
8482// stored in it.
85- void PrintFatalNote (const RecordVal *RecVal, const Twine &Msg) {
83+ void llvm:: PrintFatalNote (const RecordVal *RecVal, const Twine &Msg) {
8684 PrintNote (RecVal->getLoc (), Msg);
8785 fatal_exit ();
8886}
8987
9088// Functions to print warnings.
9189
92- void PrintWarning (const Twine &Msg) { WithColor::warning () << Msg << " \n " ; }
90+ void llvm::PrintWarning (const Twine &Msg) {
91+ WithColor::warning () << Msg << " \n " ;
92+ }
9393
94- void PrintWarning (ArrayRef<SMLoc> WarningLoc, const Twine &Msg) {
94+ void llvm:: PrintWarning (ArrayRef<SMLoc> WarningLoc, const Twine &Msg) {
9595 PrintMessage (WarningLoc, SourceMgr::DK_Warning, Msg);
9696}
9797
98- void PrintWarning (const char *Loc, const Twine &Msg) {
98+ void llvm:: PrintWarning (const char *Loc, const Twine &Msg) {
9999 SrcMgr.PrintMessage (SMLoc::getFromPointer (Loc), SourceMgr::DK_Warning, Msg);
100100}
101101
102102// Functions to print errors.
103103
104- void PrintError (const Twine &Msg) { WithColor::error () << Msg << " \n " ; }
104+ void llvm:: PrintError (const Twine &Msg) { WithColor::error () << Msg << " \n " ; }
105105
106- void PrintError (function_ref<void (raw_ostream &OS)> PrintMsg) {
106+ void llvm:: PrintError (function_ref<void (raw_ostream &OS)> PrintMsg) {
107107 PrintMsg (WithColor::error ());
108108}
109109
110- void PrintError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
110+ void llvm:: PrintError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
111111 PrintMessage (ErrorLoc, SourceMgr::DK_Error, Msg);
112112}
113113
114- void PrintError (const char *Loc, const Twine &Msg) {
114+ void llvm:: PrintError (const char *Loc, const Twine &Msg) {
115115 SrcMgr.PrintMessage (SMLoc::getFromPointer (Loc), SourceMgr::DK_Error, Msg);
116116}
117117
118118// This method takes a Record and uses the source location
119119// stored in it.
120- void PrintError (const Record *Rec, const Twine &Msg) {
120+ void llvm:: PrintError (const Record *Rec, const Twine &Msg) {
121121 PrintMessage (Rec->getLoc (), SourceMgr::DK_Error, Msg);
122122}
123123
124124// This method takes a RecordVal and uses the source location
125125// stored in it.
126- void PrintError (const RecordVal *RecVal, const Twine &Msg) {
126+ void llvm:: PrintError (const RecordVal *RecVal, const Twine &Msg) {
127127 PrintMessage (RecVal->getLoc (), SourceMgr::DK_Error, Msg);
128128}
129129
130130// Functions to print fatal errors.
131131
132- void PrintFatalError (const Twine &Msg) {
132+ void llvm:: PrintFatalError (const Twine &Msg) {
133133 PrintError (Msg);
134134 fatal_exit ();
135135}
136136
137- void PrintFatalError (function_ref<void (raw_ostream &OS)> PrintMsg) {
137+ void llvm:: PrintFatalError (function_ref<void (raw_ostream &OS)> PrintMsg) {
138138 PrintError (PrintMsg);
139139 fatal_exit ();
140140}
141141
142- void PrintFatalError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
142+ void llvm:: PrintFatalError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
143143 PrintError (ErrorLoc, Msg);
144144 fatal_exit ();
145145}
146146
147147// This method takes a Record and uses the source location
148148// stored in it.
149- void PrintFatalError (const Record *Rec, const Twine &Msg) {
149+ void llvm:: PrintFatalError (const Record *Rec, const Twine &Msg) {
150150 PrintError (Rec->getLoc (), Msg);
151151 fatal_exit ();
152152}
153153
154154// This method takes a RecordVal and uses the source location
155155// stored in it.
156- void PrintFatalError (const RecordVal *RecVal, const Twine &Msg) {
156+ void llvm:: PrintFatalError (const RecordVal *RecVal, const Twine &Msg) {
157157 PrintError (RecVal->getLoc (), Msg);
158158 fatal_exit ();
159159}
160160
161161// Check an assertion: Obtain the condition value and be sure it is true.
162162// If not, print a nonfatal error along with the message.
163- bool CheckAssert (SMLoc Loc, const Init *Condition, const Init *Message) {
163+ bool llvm:: CheckAssert (SMLoc Loc, const Init *Condition, const Init *Message) {
164164 auto *CondValue = dyn_cast_or_null<IntInit>(Condition->convertInitializerTo (
165165 IntRecTy::get (Condition->getRecordKeeper ())));
166166 if (!CondValue) {
@@ -178,11 +178,9 @@ bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message) {
178178}
179179
180180// Dump a message to stderr.
181- void dumpMessage (SMLoc Loc, const Init *Message) {
181+ void llvm:: dumpMessage (SMLoc Loc, const Init *Message) {
182182 if (auto *MessageInit = dyn_cast<StringInit>(Message))
183183 PrintNote (Loc, MessageInit->getValue ());
184184 else
185185 PrintError (Loc, " dump value is not of type string" );
186186}
187-
188- } // end namespace llvm
0 commit comments