@@ -392,8 +392,10 @@ uint32_t getNumValueKindsRT(const void *R);
392
392
#define INSTR_PROF_DATA_DEFINED
393
393
#ifdef __cplusplus
394
394
#define INSTR_PROF_INLINE inline
395
+ #define INSTR_PROF_NULLPTR nullptr
395
396
#else
396
397
#define INSTR_PROF_INLINE
398
+ #define INSTR_PROF_NULLPTR NULL
397
399
#endif
398
400
399
401
#ifndef offsetof
@@ -554,18 +556,19 @@ int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
554
556
for (I = 0 ; I <= IPVK_Last; I++) {
555
557
uint16_t N = NumValueSites[I];
556
558
if (!N) {
557
- RuntimeRecord->SiteCountArray [I] = 0 ;
559
+ RuntimeRecord->SiteCountArray [I] = INSTR_PROF_NULLPTR ;
558
560
continue ;
559
561
}
560
562
NumValueKinds++;
561
563
RuntimeRecord->SiteCountArray [I] = (uint8_t *)calloc (N, 1 );
562
564
if (!RuntimeRecord->SiteCountArray [I])
563
565
return 1 ;
564
- RuntimeRecord->NodesKind [I] = Nodes ? &Nodes[S] : NULL ;
566
+ RuntimeRecord->NodesKind [I] = Nodes ? &Nodes[S] : INSTR_PROF_NULLPTR ;
565
567
for (J = 0 ; J < N; J++) {
566
568
/* Compute value count for each site. */
567
569
uint32_t C = 0 ;
568
- ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind [I][J] : NULL ;
570
+ ValueProfNode *Site =
571
+ Nodes ? RuntimeRecord->NodesKind [I][J] : INSTR_PROF_NULLPTR;
569
572
while (Site) {
570
573
C++;
571
574
Site = Site->Next ;
@@ -606,7 +609,7 @@ uint32_t getNumValueDataForSiteRT(const void *R, uint32_t VK, uint32_t S) {
606
609
uint32_t getNumValueDataRT (const void *R, uint32_t VK) {
607
610
unsigned I, S = 0 ;
608
611
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
609
- if (Record->SiteCountArray [VK] == 0 )
612
+ if (Record->SiteCountArray [VK] == INSTR_PROF_NULLPTR )
610
613
return 0 ;
611
614
for (I = 0 ; I < Record->NumValueSites [VK]; I++)
612
615
S += Record->SiteCountArray [VK][I];
@@ -631,14 +634,10 @@ ValueProfData *allocValueProfDataRT(size_t TotalSizeInBytes) {
631
634
return (ValueProfData *)calloc (TotalSizeInBytes, 1 );
632
635
}
633
636
634
- static ValueProfRecordClosure RTRecordClosure = {0 ,
635
- getNumValueKindsRT,
636
- getNumValueSitesRT,
637
- getNumValueDataRT,
638
- getNumValueDataForSiteRT,
639
- 0 ,
640
- getValueForSiteRT,
641
- allocValueProfDataRT};
637
+ static ValueProfRecordClosure RTRecordClosure = {
638
+ INSTR_PROF_NULLPTR, getNumValueKindsRT, getNumValueSitesRT,
639
+ getNumValueDataRT, getNumValueDataForSiteRT, INSTR_PROF_NULLPTR,
640
+ getValueForSiteRT, allocValueProfDataRT};
642
641
643
642
/*
644
643
* Return the size of ValueProfData structure to store data
@@ -663,17 +662,15 @@ serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record,
663
662
return serializeValueProfDataFrom (&RTRecordClosure, DstData);
664
663
}
665
664
666
-
667
665
#undef INSTR_PROF_COMMON_API_IMPL
668
666
#endif /* INSTR_PROF_COMMON_API_IMPL */
669
667
670
668
/* ============================================================================*/
671
669
672
-
673
670
#ifndef INSTR_PROF_DATA_DEFINED
674
671
675
- #ifndef INSTR_PROF_DATA_INC_
676
- #define INSTR_PROF_DATA_INC_
672
+ #ifndef INSTR_PROF_DATA_INC
673
+ #define INSTR_PROF_DATA_INC
677
674
678
675
/* Helper macros. */
679
676
#define INSTR_PROF_SIMPLE_QUOTE (x ) #x
@@ -760,7 +757,7 @@ typedef struct ValueProfNode {
760
757
struct ValueProfNode *Next;
761
758
} ValueProfNode;
762
759
763
- #endif /* INSTR_PROF_DATA_INC_ */
760
+ #endif /* INSTR_PROF_DATA_INC */
764
761
765
762
#else
766
763
#undef INSTR_PROF_DATA_DEFINED
0 commit comments