Coverage Report

Created: 2019-03-22 08:08

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/clang-build/lib/IR/AttributesCompatFunc.inc
Line
Count
Source (jump to first uncovered line)
1
#ifdef GET_ATTR_ENUM
2
#undef GET_ATTR_ENUM
3
Alignment,
4
AllocSize,
5
AlwaysInline,
6
ArgMemOnly,
7
Builtin,
8
ByVal,
9
Cold,
10
Convergent,
11
Dereferenceable,
12
DereferenceableOrNull,
13
ImmArg,
14
InAlloca,
15
InReg,
16
InaccessibleMemOnly,
17
InaccessibleMemOrArgMemOnly,
18
InlineHint,
19
JumpTable,
20
MinSize,
21
Naked,
22
Nest,
23
NoAlias,
24
NoBuiltin,
25
NoCapture,
26
NoCfCheck,
27
NoDuplicate,
28
NoImplicitFloat,
29
NoInline,
30
NoRecurse,
31
NoRedZone,
32
NoReturn,
33
NoUnwind,
34
NonLazyBind,
35
NonNull,
36
OptForFuzzing,
37
OptimizeForSize,
38
OptimizeNone,
39
ReadNone,
40
ReadOnly,
41
Returned,
42
ReturnsTwice,
43
SExt,
44
SafeStack,
45
SanitizeAddress,
46
SanitizeHWAddress,
47
SanitizeMemory,
48
SanitizeThread,
49
ShadowCallStack,
50
Speculatable,
51
SpeculativeLoadHardening,
52
StackAlignment,
53
StackProtect,
54
StackProtectReq,
55
StackProtectStrong,
56
StrictFP,
57
StructRet,
58
SwiftError,
59
SwiftSelf,
60
UWTable,
61
WriteOnly,
62
ZExt,
63
#endif
64
#ifdef GET_ATTR_KIND_FROM_NAME
65
#undef GET_ATTR_KIND_FROM_NAME
66
0
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName) {
67
0
  return StringSwitch<Attribute::AttrKind>(AttrName)
68
0
    .Case("align", Attribute::Alignment)
69
0
    .Case("allocsize", Attribute::AllocSize)
70
0
    .Case("alwaysinline", Attribute::AlwaysInline)
71
0
    .Case("argmemonly", Attribute::ArgMemOnly)
72
0
    .Case("builtin", Attribute::Builtin)
73
0
    .Case("byval", Attribute::ByVal)
74
0
    .Case("cold", Attribute::Cold)
75
0
    .Case("convergent", Attribute::Convergent)
76
0
    .Case("dereferenceable", Attribute::Dereferenceable)
77
0
    .Case("dereferenceable_or_null", Attribute::DereferenceableOrNull)
78
0
    .Case("immarg", Attribute::ImmArg)
79
0
    .Case("inalloca", Attribute::InAlloca)
80
0
    .Case("inreg", Attribute::InReg)
81
0
    .Case("inaccessiblememonly", Attribute::InaccessibleMemOnly)
82
0
    .Case("inaccessiblemem_or_argmemonly", Attribute::InaccessibleMemOrArgMemOnly)
83
0
    .Case("inlinehint", Attribute::InlineHint)
84
0
    .Case("jumptable", Attribute::JumpTable)
85
0
    .Case("minsize", Attribute::MinSize)
86
0
    .Case("naked", Attribute::Naked)
87
0
    .Case("nest", Attribute::Nest)
88
0
    .Case("noalias", Attribute::NoAlias)
89
0
    .Case("nobuiltin", Attribute::NoBuiltin)
90
0
    .Case("nocapture", Attribute::NoCapture)
91
0
    .Case("nocf_check", Attribute::NoCfCheck)
92
0
    .Case("noduplicate", Attribute::NoDuplicate)
93
0
    .Case("noimplicitfloat", Attribute::NoImplicitFloat)
94
0
    .Case("noinline", Attribute::NoInline)
95
0
    .Case("norecurse", Attribute::NoRecurse)
96
0
    .Case("noredzone", Attribute::NoRedZone)
97
0
    .Case("noreturn", Attribute::NoReturn)
98
0
    .Case("nounwind", Attribute::NoUnwind)
99
0
    .Case("nonlazybind", Attribute::NonLazyBind)
100
0
    .Case("nonnull", Attribute::NonNull)
101
0
    .Case("optforfuzzing", Attribute::OptForFuzzing)
102
0
    .Case("optsize", Attribute::OptimizeForSize)
103
0
    .Case("optnone", Attribute::OptimizeNone)
104
0
    .Case("readnone", Attribute::ReadNone)
105
0
    .Case("readonly", Attribute::ReadOnly)
106
0
    .Case("returned", Attribute::Returned)
107
0
    .Case("returns_twice", Attribute::ReturnsTwice)
108
0
    .Case("signext", Attribute::SExt)
109
0
    .Case("safestack", Attribute::SafeStack)
110
0
    .Case("sanitize_address", Attribute::SanitizeAddress)
111
0
    .Case("sanitize_hwaddress", Attribute::SanitizeHWAddress)
112
0
    .Case("sanitize_memory", Attribute::SanitizeMemory)
113
0
    .Case("sanitize_thread", Attribute::SanitizeThread)
114
0
    .Case("shadowcallstack", Attribute::ShadowCallStack)
115
0
    .Case("speculatable", Attribute::Speculatable)
116
0
    .Case("speculative_load_hardening", Attribute::SpeculativeLoadHardening)
117
0
    .Case("alignstack", Attribute::StackAlignment)
118
0
    .Case("ssp", Attribute::StackProtect)
119
0
    .Case("sspreq", Attribute::StackProtectReq)
120
0
    .Case("sspstrong", Attribute::StackProtectStrong)
121
0
    .Case("strictfp", Attribute::StrictFP)
122
0
    .Case("sret", Attribute::StructRet)
123
0
    .Case("swifterror", Attribute::SwiftError)
124
0
    .Case("swiftself", Attribute::SwiftSelf)
125
0
    .Case("uwtable", Attribute::UWTable)
126
0
    .Case("writeonly", Attribute::WriteOnly)
127
0
    .Case("zeroext", Attribute::ZExt)
128
0
    .Default(Attribute::None);
129
0
}
130
131
#endif
132
#ifdef GET_ATTR_COMPAT_FUNC
133
#undef GET_ATTR_COMPAT_FUNC
134
struct EnumAttr {
135
  static bool isSet(const Function &Fn,
136
2.11M
                    Attribute::AttrKind Kind) {
137
2.11M
    return Fn.hasFnAttribute(Kind);
138
2.11M
  }
139
140
  static void set(Function &Fn,
141
4
                  Attribute::AttrKind Kind, bool Val) {
142
4
    if (Val)
143
4
      Fn.addFnAttr(Kind);
144
0
    else
145
0
      Fn.removeFnAttr(Kind);
146
4
  }
147
};
148
149
struct StrBoolAttr {
150
  static bool isSet(const Function &Fn,
151
4.22M
                    StringRef Kind) {
152
4.22M
    auto A = Fn.getFnAttribute(Kind);
153
4.22M
    return A.getValueAsString().equals("true");
154
4.22M
  }
155
156
  static void set(Function &Fn,
157
10
                  StringRef Kind, bool Val) {
158
10
    Fn.addFnAttr(Kind, Val ? 
"true"2
:
"false"8
);
159
10
  }
160
};
161
162
// EnumAttr classes
163
struct AlignmentAttr : EnumAttr {
164
0
  static enum Attribute::AttrKind getKind() {
165
0
    return llvm::Attribute::Alignment;
166
0
  }
167
};
168
struct AllocSizeAttr : EnumAttr {
169
0
  static enum Attribute::AttrKind getKind() {
170
0
    return llvm::Attribute::AllocSize;
171
0
  }
172
};
173
struct AlwaysInlineAttr : EnumAttr {
174
0
  static enum Attribute::AttrKind getKind() {
175
0
    return llvm::Attribute::AlwaysInline;
176
0
  }
177
};
178
struct ArgMemOnlyAttr : EnumAttr {
179
0
  static enum Attribute::AttrKind getKind() {
180
0
    return llvm::Attribute::ArgMemOnly;
181
0
  }
182
};
183
struct BuiltinAttr : EnumAttr {
184
0
  static enum Attribute::AttrKind getKind() {
185
0
    return llvm::Attribute::Builtin;
186
0
  }
187
};
188
struct ByValAttr : EnumAttr {
189
0
  static enum Attribute::AttrKind getKind() {
190
0
    return llvm::Attribute::ByVal;
191
0
  }
192
};
193
struct ColdAttr : EnumAttr {
194
0
  static enum Attribute::AttrKind getKind() {
195
0
    return llvm::Attribute::Cold;
196
0
  }
197
};
198
struct ConvergentAttr : EnumAttr {
199
0
  static enum Attribute::AttrKind getKind() {
200
0
    return llvm::Attribute::Convergent;
201
0
  }
202
};
203
struct DereferenceableAttr : EnumAttr {
204
0
  static enum Attribute::AttrKind getKind() {
205
0
    return llvm::Attribute::Dereferenceable;
206
0
  }
207
};
208
struct DereferenceableOrNullAttr : EnumAttr {
209
0
  static enum Attribute::AttrKind getKind() {
210
0
    return llvm::Attribute::DereferenceableOrNull;
211
0
  }
212
};
213
struct ImmArgAttr : EnumAttr {
214
0
  static enum Attribute::AttrKind getKind() {
215
0
    return llvm::Attribute::ImmArg;
216
0
  }
217
};
218
struct InAllocaAttr : EnumAttr {
219
0
  static enum Attribute::AttrKind getKind() {
220
0
    return llvm::Attribute::InAlloca;
221
0
  }
222
};
223
struct InRegAttr : EnumAttr {
224
0
  static enum Attribute::AttrKind getKind() {
225
0
    return llvm::Attribute::InReg;
226
0
  }
227
};
228
struct InaccessibleMemOnlyAttr : EnumAttr {
229
0
  static enum Attribute::AttrKind getKind() {
230
0
    return llvm::Attribute::InaccessibleMemOnly;
231
0
  }
232
};
233
struct InaccessibleMemOrArgMemOnlyAttr : EnumAttr {
234
0
  static enum Attribute::AttrKind getKind() {
235
0
    return llvm::Attribute::InaccessibleMemOrArgMemOnly;
236
0
  }
237
};
238
struct InlineHintAttr : EnumAttr {
239
0
  static enum Attribute::AttrKind getKind() {
240
0
    return llvm::Attribute::InlineHint;
241
0
  }
242
};
243
struct JumpTableAttr : EnumAttr {
244
0
  static enum Attribute::AttrKind getKind() {
245
0
    return llvm::Attribute::JumpTable;
246
0
  }
247
};
248
struct MinSizeAttr : EnumAttr {
249
0
  static enum Attribute::AttrKind getKind() {
250
0
    return llvm::Attribute::MinSize;
251
0
  }
252
};
253
struct NakedAttr : EnumAttr {
254
0
  static enum Attribute::AttrKind getKind() {
255
0
    return llvm::Attribute::Naked;
256
0
  }
257
};
258
struct NestAttr : EnumAttr {
259
0
  static enum Attribute::AttrKind getKind() {
260
0
    return llvm::Attribute::Nest;
261
0
  }
262
};
263
struct NoAliasAttr : EnumAttr {
264
0
  static enum Attribute::AttrKind getKind() {
265
0
    return llvm::Attribute::NoAlias;
266
0
  }
267
};
268
struct NoBuiltinAttr : EnumAttr {
269
0
  static enum Attribute::AttrKind getKind() {
270
0
    return llvm::Attribute::NoBuiltin;
271
0
  }
272
};
273
struct NoCaptureAttr : EnumAttr {
274
0
  static enum Attribute::AttrKind getKind() {
275
0
    return llvm::Attribute::NoCapture;
276
0
  }
277
};
278
struct NoCfCheckAttr : EnumAttr {
279
0
  static enum Attribute::AttrKind getKind() {
280
0
    return llvm::Attribute::NoCfCheck;
281
0
  }
282
};
283
struct NoDuplicateAttr : EnumAttr {
284
0
  static enum Attribute::AttrKind getKind() {
285
0
    return llvm::Attribute::NoDuplicate;
286
0
  }
287
};
288
struct NoImplicitFloatAttr : EnumAttr {
289
1.05M
  static enum Attribute::AttrKind getKind() {
290
1.05M
    return llvm::Attribute::NoImplicitFloat;
291
1.05M
  }
292
};
293
struct NoInlineAttr : EnumAttr {
294
0
  static enum Attribute::AttrKind getKind() {
295
0
    return llvm::Attribute::NoInline;
296
0
  }
297
};
298
struct NoRecurseAttr : EnumAttr {
299
0
  static enum Attribute::AttrKind getKind() {
300
0
    return llvm::Attribute::NoRecurse;
301
0
  }
302
};
303
struct NoRedZoneAttr : EnumAttr {
304
0
  static enum Attribute::AttrKind getKind() {
305
0
    return llvm::Attribute::NoRedZone;
306
0
  }
307
};
308
struct NoReturnAttr : EnumAttr {
309
0
  static enum Attribute::AttrKind getKind() {
310
0
    return llvm::Attribute::NoReturn;
311
0
  }
312
};
313
struct NoUnwindAttr : EnumAttr {
314
0
  static enum Attribute::AttrKind getKind() {
315
0
    return llvm::Attribute::NoUnwind;
316
0
  }
317
};
318
struct NonLazyBindAttr : EnumAttr {
319
0
  static enum Attribute::AttrKind getKind() {
320
0
    return llvm::Attribute::NonLazyBind;
321
0
  }
322
};
323
struct NonNullAttr : EnumAttr {
324
0
  static enum Attribute::AttrKind getKind() {
325
0
    return llvm::Attribute::NonNull;
326
0
  }
327
};
328
struct OptForFuzzingAttr : EnumAttr {
329
0
  static enum Attribute::AttrKind getKind() {
330
0
    return llvm::Attribute::OptForFuzzing;
331
0
  }
332
};
333
struct OptimizeForSizeAttr : EnumAttr {
334
0
  static enum Attribute::AttrKind getKind() {
335
0
    return llvm::Attribute::OptimizeForSize;
336
0
  }
337
};
338
struct OptimizeNoneAttr : EnumAttr {
339
0
  static enum Attribute::AttrKind getKind() {
340
0
    return llvm::Attribute::OptimizeNone;
341
0
  }
342
};
343
struct ReadNoneAttr : EnumAttr {
344
0
  static enum Attribute::AttrKind getKind() {
345
0
    return llvm::Attribute::ReadNone;
346
0
  }
347
};
348
struct ReadOnlyAttr : EnumAttr {
349
0
  static enum Attribute::AttrKind getKind() {
350
0
    return llvm::Attribute::ReadOnly;
351
0
  }
352
};
353
struct ReturnedAttr : EnumAttr {
354
0
  static enum Attribute::AttrKind getKind() {
355
0
    return llvm::Attribute::Returned;
356
0
  }
357
};
358
struct ReturnsTwiceAttr : EnumAttr {
359
0
  static enum Attribute::AttrKind getKind() {
360
0
    return llvm::Attribute::ReturnsTwice;
361
0
  }
362
};
363
struct SExtAttr : EnumAttr {
364
0
  static enum Attribute::AttrKind getKind() {
365
0
    return llvm::Attribute::SExt;
366
0
  }
367
};
368
struct SafeStackAttr : EnumAttr {
369
3.08M
  static enum Attribute::AttrKind getKind() {
370
3.08M
    return llvm::Attribute::SafeStack;
371
3.08M
  }
372
};
373
struct SanitizeAddressAttr : EnumAttr {
374
3.08M
  static enum Attribute::AttrKind getKind() {
375
3.08M
    return llvm::Attribute::SanitizeAddress;
376
3.08M
  }
377
};
378
struct SanitizeHWAddressAttr : EnumAttr {
379
3.08M
  static enum Attribute::AttrKind getKind() {
380
3.08M
    return llvm::Attribute::SanitizeHWAddress;
381
3.08M
  }
382
};
383
struct SanitizeMemoryAttr : EnumAttr {
384
3.08M
  static enum Attribute::AttrKind getKind() {
385
3.08M
    return llvm::Attribute::SanitizeMemory;
386
3.08M
  }
387
};
388
struct SanitizeThreadAttr : EnumAttr {
389
3.08M
  static enum Attribute::AttrKind getKind() {
390
3.08M
    return llvm::Attribute::SanitizeThread;
391
3.08M
  }
392
};
393
struct ShadowCallStackAttr : EnumAttr {
394
3.08M
  static enum Attribute::AttrKind getKind() {
395
3.08M
    return llvm::Attribute::ShadowCallStack;
396
3.08M
  }
397
};
398
struct SpeculatableAttr : EnumAttr {
399
0
  static enum Attribute::AttrKind getKind() {
400
0
    return llvm::Attribute::Speculatable;
401
0
  }
402
};
403
struct SpeculativeLoadHardeningAttr : EnumAttr {
404
1.05M
  static enum Attribute::AttrKind getKind() {
405
1.05M
    return llvm::Attribute::SpeculativeLoadHardening;
406
1.05M
  }
407
};
408
struct StackAlignmentAttr : EnumAttr {
409
0
  static enum Attribute::AttrKind getKind() {
410
0
    return llvm::Attribute::StackAlignment;
411
0
  }
412
};
413
struct StackProtectAttr : EnumAttr {
414
0
  static enum Attribute::AttrKind getKind() {
415
0
    return llvm::Attribute::StackProtect;
416
0
  }
417
};
418
struct StackProtectReqAttr : EnumAttr {
419
0
  static enum Attribute::AttrKind getKind() {
420
0
    return llvm::Attribute::StackProtectReq;
421
0
  }
422
};
423
struct StackProtectStrongAttr : EnumAttr {
424
0
  static enum Attribute::AttrKind getKind() {
425
0
    return llvm::Attribute::StackProtectStrong;
426
0
  }
427
};
428
struct StrictFPAttr : EnumAttr {
429
0
  static enum Attribute::AttrKind getKind() {
430
0
    return llvm::Attribute::StrictFP;
431
0
  }
432
};
433
struct StructRetAttr : EnumAttr {
434
0
  static enum Attribute::AttrKind getKind() {
435
0
    return llvm::Attribute::StructRet;
436
0
  }
437
};
438
struct SwiftErrorAttr : EnumAttr {
439
0
  static enum Attribute::AttrKind getKind() {
440
0
    return llvm::Attribute::SwiftError;
441
0
  }
442
};
443
struct SwiftSelfAttr : EnumAttr {
444
0
  static enum Attribute::AttrKind getKind() {
445
0
    return llvm::Attribute::SwiftSelf;
446
0
  }
447
};
448
struct UWTableAttr : EnumAttr {
449
0
  static enum Attribute::AttrKind getKind() {
450
0
    return llvm::Attribute::UWTable;
451
0
  }
452
};
453
struct WriteOnlyAttr : EnumAttr {
454
0
  static enum Attribute::AttrKind getKind() {
455
0
    return llvm::Attribute::WriteOnly;
456
0
  }
457
};
458
struct ZExtAttr : EnumAttr {
459
0
  static enum Attribute::AttrKind getKind() {
460
0
    return llvm::Attribute::ZExt;
461
0
  }
462
};
463
464
// StrBoolAttr classes
465
struct LessPreciseFPMADAttr : StrBoolAttr {
466
527k
  static StringRef getKind() {
467
527k
    return "less-precise-fpmad";
468
527k
  }
469
};
470
struct NoInfsFPMathAttr : StrBoolAttr {
471
528k
  static StringRef getKind() {
472
528k
    return "no-infs-fp-math";
473
528k
  }
474
};
475
struct NoJumpTablesAttr : StrBoolAttr {
476
1.05M
  static StringRef getKind() {
477
1.05M
    return "no-jump-tables";
478
1.05M
  }
479
};
480
struct NoNansFPMathAttr : StrBoolAttr {
481
528k
  static StringRef getKind() {
482
528k
    return "no-nans-fp-math";
483
528k
  }
484
};
485
struct ProfileSampleAccurateAttr : StrBoolAttr {
486
1.05M
  static StringRef getKind() {
487
1.05M
    return "profile-sample-accurate";
488
1.05M
  }
489
};
490
struct UnsafeFPMathAttr : StrBoolAttr {
491
528k
  static StringRef getKind() {
492
528k
    return "unsafe-fp-math";
493
528k
  }
494
};
495
496
static inline bool hasCompatibleFnAttrs(const Function &Caller,
497
1.54M
                                        const Function &Callee) {
498
1.54M
  bool Ret = true;
499
1.54M
500
1.54M
  Ret &= isEqual<SanitizeAddressAttr>(Caller, Callee);
501
1.54M
  Ret &= isEqual<SanitizeThreadAttr>(Caller, Callee);
502
1.54M
  Ret &= isEqual<SanitizeMemoryAttr>(Caller, Callee);
503
1.54M
  Ret &= isEqual<SanitizeHWAddressAttr>(Caller, Callee);
504
1.54M
  Ret &= isEqual<SafeStackAttr>(Caller, Callee);
505
1.54M
  Ret &= isEqual<ShadowCallStackAttr>(Caller, Callee);
506
1.54M
507
1.54M
  return Ret;
508
1.54M
}
509
510
static inline void mergeFnAttrs(Function &Caller,
511
527k
                                const Function &Callee) {
512
527k
  setOR<NoImplicitFloatAttr>(Caller, Callee);
513
527k
  setOR<NoJumpTablesAttr>(Caller, Callee);
514
527k
  setOR<ProfileSampleAccurateAttr>(Caller, Callee);
515
527k
  setOR<SpeculativeLoadHardeningAttr>(Caller, Callee);
516
527k
  adjustCallerSSPLevel(Caller, Callee);
517
527k
  adjustCallerStackProbes(Caller, Callee);
518
527k
  adjustCallerStackProbeSize(Caller, Callee);
519
527k
  adjustMinLegalVectorWidth(Caller, Callee);
520
527k
  adjustNullPointerValidAttr(Caller, Callee);
521
527k
  setAND<LessPreciseFPMADAttr>(Caller, Callee);
522
527k
  setAND<NoInfsFPMathAttr>(Caller, Callee);
523
527k
  setAND<NoNansFPMathAttr>(Caller, Callee);
524
527k
  setAND<UnsafeFPMathAttr>(Caller, Callee);
525
527k
}
526
527
#endif