Commit 06939fa
authored
[lldb] Change the implementation of Status to store an llvm::Error (NFC) (#106774)
(based on a conversation I had with @labath yesterday in
llvm/llvm-project#106442)
Most APIs that currently vend a Status would be better served by
returning llvm::Expected<> instead. If possibles APIs should be
refactored to avoid Status. The only legitimate long-term uses of Status
are objects that need to store an error for a long time (which should be
questioned as a design decision, too).
This patch makes the transition to llvm::Error easier by making the
places that cannot switch to llvm::Error explicit: They are marked with
a call to Status::clone(). Every other API can and should be refactored
to use llvm::Expected. In the end Status should only be used in very few
places.
Whenever an unchecked Error is dropped by Status it logs this to the
verbose API channel.
Implementation notes:
This patch introduces two new kinds of error_category as well as new
llvm::Error types. Here is the mapping of lldb::ErrorType to
llvm::Errors:
```
(eErrorTypeInvalid)
eErrorTypeGeneric llvm::StringError
eErrorTypePOSIX llvm::ECError
eErrorTypeMachKernel MachKernelError
eErrorTypeExpression llvm::ErrorList<ExpressionError>
eErrorTypeWin32 Win32Error
```1 parent a7c1745 commit 06939fa
File tree
5 files changed
+285
-108
lines changed- lldb
- include/lldb/Utility
- source
- Plugins/ScriptInterpreter/Python
- Utility
- unittests
- TestingSupport/Host
- Utility
5 files changed
+285
-108
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
31 | 94 | | |
32 | 95 | | |
33 | 96 | | |
| |||
100 | 163 | | |
101 | 164 | | |
102 | 165 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 166 | + | |
106 | 167 | | |
107 | 168 | | |
108 | 169 | | |
| |||
115 | 176 | | |
116 | 177 | | |
117 | 178 | | |
| 179 | + | |
118 | 180 | | |
119 | 181 | | |
120 | 182 | | |
| |||
149 | 211 | | |
150 | 212 | | |
151 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
152 | 218 | | |
153 | 219 | | |
154 | 220 | | |
155 | 221 | | |
156 | 222 | | |
157 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
158 | 228 | | |
159 | 229 | | |
160 | 230 | | |
| |||
170 | 240 | | |
171 | 241 | | |
172 | 242 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
179 | 246 | | |
180 | 247 | | |
181 | 248 | | |
| |||
Lines changed: 20 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
993 | 993 | | |
994 | 994 | | |
995 | 995 | | |
996 | | - | |
997 | 996 | | |
| 997 | + | |
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
| |||
1108 | 1108 | | |
1109 | 1109 | | |
1110 | 1110 | | |
| 1111 | + | |
1111 | 1112 | | |
1112 | | - | |
1113 | | - | |
| 1113 | + | |
| 1114 | + | |
1114 | 1115 | | |
1115 | 1116 | | |
1116 | 1117 | | |
| |||
1196 | 1197 | | |
1197 | 1198 | | |
1198 | 1199 | | |
1199 | | - | |
| 1200 | + | |
| 1201 | + | |
1200 | 1202 | | |
1201 | 1203 | | |
1202 | 1204 | | |
1203 | 1205 | | |
1204 | 1206 | | |
1205 | 1207 | | |
1206 | 1208 | | |
1207 | | - | |
| 1209 | + | |
| 1210 | + | |
1208 | 1211 | | |
1209 | 1212 | | |
1210 | 1213 | | |
| |||
1240 | 1243 | | |
1241 | 1244 | | |
1242 | 1245 | | |
1243 | | - | |
| 1246 | + | |
| 1247 | + | |
1244 | 1248 | | |
1245 | 1249 | | |
1246 | 1250 | | |
| |||
1260 | 1264 | | |
1261 | 1265 | | |
1262 | 1266 | | |
1263 | | - | |
| 1267 | + | |
| 1268 | + | |
1264 | 1269 | | |
1265 | 1270 | | |
1266 | 1271 | | |
| |||
1269 | 1274 | | |
1270 | 1275 | | |
1271 | 1276 | | |
1272 | | - | |
| 1277 | + | |
| 1278 | + | |
1273 | 1279 | | |
1274 | 1280 | | |
1275 | 1281 | | |
| |||
1300 | 1306 | | |
1301 | 1307 | | |
1302 | 1308 | | |
1303 | | - | |
| 1309 | + | |
| 1310 | + | |
1304 | 1311 | | |
1305 | 1312 | | |
1306 | 1313 | | |
| |||
1321 | 1328 | | |
1322 | 1329 | | |
1323 | 1330 | | |
1324 | | - | |
| 1331 | + | |
| 1332 | + | |
1325 | 1333 | | |
1326 | 1334 | | |
1327 | 1335 | | |
1328 | 1336 | | |
1329 | 1337 | | |
1330 | 1338 | | |
1331 | | - | |
| 1339 | + | |
| 1340 | + | |
1332 | 1341 | | |
1333 | 1342 | | |
1334 | 1343 | | |
| |||
0 commit comments