@@ -330,7 +330,8 @@ std::string OICodeGen::stripFullyQualifiedNameWithSeparators(
330
330
// Replace a specific template parameter with a generic DummySizedOperator
331
331
void OICodeGen::replaceTemplateOperator (
332
332
TemplateParamList& template_params,
333
- std::vector<std::string>& template_params_strings, size_t index) {
333
+ std::vector<std::string>& template_params_strings,
334
+ size_t index) {
334
335
if (index >= template_params.size ()) {
335
336
// Should this happen?
336
337
return ;
@@ -365,7 +366,8 @@ void OICodeGen::replaceTemplateOperator(
365
366
}
366
367
367
368
void OICodeGen::replaceTemplateParameters (
368
- drgn_type* type, TemplateParamList& template_params,
369
+ drgn_type* type,
370
+ TemplateParamList& template_params,
369
371
std::vector<std::string>& template_params_strings,
370
372
const std::string& nameWithoutTemplate) {
371
373
auto optContainerInfo = getContainerInfo (type);
@@ -393,7 +395,8 @@ void OICodeGen::replaceTemplateParameters(
393
395
}
394
396
}
395
397
396
- bool OICodeGen::buildName (drgn_type* type, std::string& text,
398
+ bool OICodeGen::buildName (drgn_type* type,
399
+ std::string& text,
397
400
std::string& outName) {
398
401
int ptrDepth = 0 ;
399
402
drgn_type* ut = type;
@@ -418,7 +421,8 @@ bool OICodeGen::buildName(drgn_type* type, std::string& text,
418
421
return true ;
419
422
}
420
423
421
- bool OICodeGen::buildNameInt (drgn_type* type, std::string& nameWithoutTemplate,
424
+ bool OICodeGen::buildNameInt (drgn_type* type,
425
+ std::string& nameWithoutTemplate,
422
426
std::string& outName) {
423
427
// Calling buildName only makes sense if a type is a container and has
424
428
// template parameters. For a generic template class, we just flatten the
@@ -588,7 +592,8 @@ bool OICodeGen::buildNameInt(drgn_type* type, std::string& nameWithoutTemplate,
588
592
}
589
593
590
594
bool OICodeGen::getTemplateParams (
591
- drgn_type* type, size_t numTemplateParams,
595
+ drgn_type* type,
596
+ size_t numTemplateParams,
592
597
std::vector<std::pair<drgn_qualified_type, std::string>>& v) {
593
598
drgn_type_template_parameter* tParams = drgn_type_template_parameters (type);
594
599
@@ -1662,8 +1667,10 @@ std::optional<std::string> OICodeGen::getNameForType(drgn_type* type) {
1662
1667
}
1663
1668
1664
1669
void OICodeGen::getFuncDefClassMembers (
1665
- std::string& code, drgn_type* type,
1666
- std::unordered_map<std::string, int >& memberNames, bool skipPadding) {
1670
+ std::string& code,
1671
+ drgn_type* type,
1672
+ std::unordered_map<std::string, int >& memberNames,
1673
+ bool skipPadding) {
1667
1674
if (drgn_type_kind (type) == DRGN_TYPE_TYPEDEF) {
1668
1675
// Handle case where parent is a typedef
1669
1676
getFuncDefClassMembers (code, drgnUnderlyingType (type), memberNames);
@@ -1761,7 +1768,8 @@ void OICodeGen::enumerateDescendants(drgn_type* type, drgn_type* baseType) {
1761
1768
}
1762
1769
}
1763
1770
1764
- void OICodeGen::getFuncDefinitionStr (std::string& code, drgn_type* type,
1771
+ void OICodeGen::getFuncDefinitionStr (std::string& code,
1772
+ drgn_type* type,
1765
1773
const std::string& typeName) {
1766
1774
if (classMembersMap.find (type) == classMembersMap.end ()) {
1767
1775
return ;
@@ -2380,8 +2388,10 @@ bool OICodeGen::addPadding(uint64_t padding_bits, std::string& code) {
2380
2388
return true ;
2381
2389
}
2382
2390
2383
- static inline void addSizeComment (bool genPaddingStats, std::string& code,
2384
- size_t offset, size_t sizeInBits) {
2391
+ static inline void addSizeComment (bool genPaddingStats,
2392
+ std::string& code,
2393
+ size_t offset,
2394
+ size_t sizeInBits) {
2385
2395
if (!genPaddingStats) {
2386
2396
return ;
2387
2397
}
@@ -2417,8 +2427,10 @@ void OICodeGen::deduplicateMemberName(
2417
2427
2418
2428
std::optional<uint64_t > OICodeGen::generateMember (
2419
2429
const DrgnClassMemberInfo& m,
2420
- std::unordered_map<std::string, int >& memberNames, uint64_t currOffsetBits,
2421
- std::string& code, bool isInUnion) {
2430
+ std::unordered_map<std::string, int >& memberNames,
2431
+ uint64_t currOffsetBits,
2432
+ std::string& code,
2433
+ bool isInUnion) {
2422
2434
// Generate unique name for member
2423
2435
std::string memberName = m.member_name ;
2424
2436
deduplicateMemberName (memberNames, memberName);
@@ -2513,8 +2525,11 @@ std::optional<uint64_t> OICodeGen::generateMember(
2513
2525
}
2514
2526
2515
2527
bool OICodeGen::generateParent (
2516
- drgn_type* p, std::unordered_map<std::string, int >& memberNames,
2517
- uint64_t & currOffsetBits, std::string& code, size_t offsetToNextMember) {
2528
+ drgn_type* p,
2529
+ std::unordered_map<std::string, int >& memberNames,
2530
+ uint64_t & currOffsetBits,
2531
+ std::string& code,
2532
+ size_t offsetToNextMember) {
2518
2533
// Parent class could be a typedef
2519
2534
PaddingInfo paddingInfo{};
2520
2535
bool violatesAlignmentRequirement = false ;
@@ -2606,9 +2621,13 @@ std::optional<uint64_t> OICodeGen::getAlignmentRequirements(drgn_type* e) {
2606
2621
}
2607
2622
2608
2623
bool OICodeGen::generateStructMembers (
2609
- drgn_type* e, std::unordered_map<std::string, int >& memberNames,
2610
- std::string& code, uint64_t & out_offset_bits, PaddingInfo& paddingInfo,
2611
- bool & violatesAlignmentRequirement, size_t offsetToNextMemberInSubclass) {
2624
+ drgn_type* e,
2625
+ std::unordered_map<std::string, int >& memberNames,
2626
+ std::string& code,
2627
+ uint64_t & out_offset_bits,
2628
+ PaddingInfo& paddingInfo,
2629
+ bool & violatesAlignmentRequirement,
2630
+ size_t offsetToNextMemberInSubclass) {
2612
2631
if (classMembersMap.find (e) == classMembersMap.end ()) {
2613
2632
VLOG (1 ) << " Failed to find type in classMembersMap: " << e;
2614
2633
}
@@ -3632,8 +3651,10 @@ bool OICodeGen::generate(std::string& code) {
3632
3651
* Generate static_asserts for the offsets of each member of the given type
3633
3652
*/
3634
3653
bool OICodeGen::staticAssertMemberOffsets (
3635
- const std::string& struct_name, drgn_type* struct_type,
3636
- std::string& assert_str, std::unordered_map<std::string, int >& memberNames,
3654
+ const std::string& struct_name,
3655
+ drgn_type* struct_type,
3656
+ std::string& assert_str,
3657
+ std::unordered_map<std::string, int >& memberNames,
3637
3658
uint64_t base_offset) {
3638
3659
if (knownDummyTypeList.find (struct_type) != knownDummyTypeList.end ()) {
3639
3660
return true ;
0 commit comments