19
19
#include " llvm/TableGen/Record.h"
20
20
#include < cstdlib>
21
21
22
- namespace llvm {
22
+ using namespace llvm ;
23
23
24
- SourceMgr SrcMgr;
25
- unsigned ErrorsPrinted = 0 ;
24
+ SourceMgr llvm:: SrcMgr;
25
+ unsigned llvm:: ErrorsPrinted = 0 ;
26
26
27
27
static void PrintMessage (ArrayRef<SMLoc> Locs, SourceMgr::DiagKind Kind,
28
28
const Twine &Msg) {
@@ -49,118 +49,118 @@ static void PrintMessage(ArrayRef<SMLoc> Locs, SourceMgr::DiagKind Kind,
49
49
50
50
// Functions to print notes.
51
51
52
- void PrintNote (const Twine &Msg) {
53
- WithColor::note () << Msg << " \n " ;
54
- }
52
+ void llvm::PrintNote (const Twine &Msg) { WithColor::note () << Msg << " \n " ; }
55
53
56
- void PrintNote (function_ref<void (raw_ostream &OS)> PrintMsg) {
54
+ void llvm:: PrintNote (function_ref<void (raw_ostream &OS)> PrintMsg) {
57
55
PrintMsg (WithColor::note ());
58
56
}
59
57
60
- void PrintNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
58
+ void llvm:: PrintNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
61
59
PrintMessage (NoteLoc, SourceMgr::DK_Note, Msg);
62
60
}
63
61
64
62
// Functions to print fatal notes.
65
63
66
- void PrintFatalNote (const Twine &Msg) {
64
+ void llvm:: PrintFatalNote (const Twine &Msg) {
67
65
PrintNote (Msg);
68
66
fatal_exit ();
69
67
}
70
68
71
- void PrintFatalNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
69
+ void llvm:: PrintFatalNote (ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
72
70
PrintNote (NoteLoc, Msg);
73
71
fatal_exit ();
74
72
}
75
73
76
74
// This method takes a Record and uses the source location
77
75
// stored in it.
78
- void PrintFatalNote (const Record *Rec, const Twine &Msg) {
76
+ void llvm:: PrintFatalNote (const Record *Rec, const Twine &Msg) {
79
77
PrintNote (Rec->getLoc (), Msg);
80
78
fatal_exit ();
81
79
}
82
80
83
81
// This method takes a RecordVal and uses the source location
84
82
// stored in it.
85
- void PrintFatalNote (const RecordVal *RecVal, const Twine &Msg) {
83
+ void llvm:: PrintFatalNote (const RecordVal *RecVal, const Twine &Msg) {
86
84
PrintNote (RecVal->getLoc (), Msg);
87
85
fatal_exit ();
88
86
}
89
87
90
88
// Functions to print warnings.
91
89
92
- void PrintWarning (const Twine &Msg) { WithColor::warning () << Msg << " \n " ; }
90
+ void llvm::PrintWarning (const Twine &Msg) {
91
+ WithColor::warning () << Msg << " \n " ;
92
+ }
93
93
94
- void PrintWarning (ArrayRef<SMLoc> WarningLoc, const Twine &Msg) {
94
+ void llvm:: PrintWarning (ArrayRef<SMLoc> WarningLoc, const Twine &Msg) {
95
95
PrintMessage (WarningLoc, SourceMgr::DK_Warning, Msg);
96
96
}
97
97
98
- void PrintWarning (const char *Loc, const Twine &Msg) {
98
+ void llvm:: PrintWarning (const char *Loc, const Twine &Msg) {
99
99
SrcMgr.PrintMessage (SMLoc::getFromPointer (Loc), SourceMgr::DK_Warning, Msg);
100
100
}
101
101
102
102
// Functions to print errors.
103
103
104
- void PrintError (const Twine &Msg) { WithColor::error () << Msg << " \n " ; }
104
+ void llvm:: PrintError (const Twine &Msg) { WithColor::error () << Msg << " \n " ; }
105
105
106
- void PrintError (function_ref<void (raw_ostream &OS)> PrintMsg) {
106
+ void llvm:: PrintError (function_ref<void (raw_ostream &OS)> PrintMsg) {
107
107
PrintMsg (WithColor::error ());
108
108
}
109
109
110
- void PrintError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
110
+ void llvm:: PrintError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
111
111
PrintMessage (ErrorLoc, SourceMgr::DK_Error, Msg);
112
112
}
113
113
114
- void PrintError (const char *Loc, const Twine &Msg) {
114
+ void llvm:: PrintError (const char *Loc, const Twine &Msg) {
115
115
SrcMgr.PrintMessage (SMLoc::getFromPointer (Loc), SourceMgr::DK_Error, Msg);
116
116
}
117
117
118
118
// This method takes a Record and uses the source location
119
119
// stored in it.
120
- void PrintError (const Record *Rec, const Twine &Msg) {
120
+ void llvm:: PrintError (const Record *Rec, const Twine &Msg) {
121
121
PrintMessage (Rec->getLoc (), SourceMgr::DK_Error, Msg);
122
122
}
123
123
124
124
// This method takes a RecordVal and uses the source location
125
125
// stored in it.
126
- void PrintError (const RecordVal *RecVal, const Twine &Msg) {
126
+ void llvm:: PrintError (const RecordVal *RecVal, const Twine &Msg) {
127
127
PrintMessage (RecVal->getLoc (), SourceMgr::DK_Error, Msg);
128
128
}
129
129
130
130
// Functions to print fatal errors.
131
131
132
- void PrintFatalError (const Twine &Msg) {
132
+ void llvm:: PrintFatalError (const Twine &Msg) {
133
133
PrintError (Msg);
134
134
fatal_exit ();
135
135
}
136
136
137
- void PrintFatalError (function_ref<void (raw_ostream &OS)> PrintMsg) {
137
+ void llvm:: PrintFatalError (function_ref<void (raw_ostream &OS)> PrintMsg) {
138
138
PrintError (PrintMsg);
139
139
fatal_exit ();
140
140
}
141
141
142
- void PrintFatalError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
142
+ void llvm:: PrintFatalError (ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
143
143
PrintError (ErrorLoc, Msg);
144
144
fatal_exit ();
145
145
}
146
146
147
147
// This method takes a Record and uses the source location
148
148
// stored in it.
149
- void PrintFatalError (const Record *Rec, const Twine &Msg) {
149
+ void llvm:: PrintFatalError (const Record *Rec, const Twine &Msg) {
150
150
PrintError (Rec->getLoc (), Msg);
151
151
fatal_exit ();
152
152
}
153
153
154
154
// This method takes a RecordVal and uses the source location
155
155
// stored in it.
156
- void PrintFatalError (const RecordVal *RecVal, const Twine &Msg) {
156
+ void llvm:: PrintFatalError (const RecordVal *RecVal, const Twine &Msg) {
157
157
PrintError (RecVal->getLoc (), Msg);
158
158
fatal_exit ();
159
159
}
160
160
161
161
// Check an assertion: Obtain the condition value and be sure it is true.
162
162
// 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) {
164
164
auto *CondValue = dyn_cast_or_null<IntInit>(Condition->convertInitializerTo (
165
165
IntRecTy::get (Condition->getRecordKeeper ())));
166
166
if (!CondValue) {
@@ -178,11 +178,9 @@ bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message) {
178
178
}
179
179
180
180
// Dump a message to stderr.
181
- void dumpMessage (SMLoc Loc, const Init *Message) {
181
+ void llvm:: dumpMessage (SMLoc Loc, const Init *Message) {
182
182
if (auto *MessageInit = dyn_cast<StringInit>(Message))
183
183
PrintNote (Loc, MessageInit->getValue ());
184
184
else
185
185
PrintError (Loc, " dump value is not of type string" );
186
186
}
187
-
188
- } // end namespace llvm
0 commit comments