File tree 2 files changed +12
-9
lines changed 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -659,12 +659,18 @@ void CodeGenPGO::mapRegionCounters(const Decl *D) {
659
659
FunctionHash = Walker.Hash .finalize ();
660
660
}
661
661
662
- void CodeGenPGO::emitCounterRegionMapping (const Decl *D) {
662
+ bool CodeGenPGO::skipRegionMappingForDecl (const Decl *D) {
663
663
if (SkipCoverageMapping)
664
- return ;
665
- // Don't map the functions inside the system headers
664
+ return true ;
665
+
666
+ // Don't map the functions in system headers.
667
+ const auto &SM = CGM.getContext ().getSourceManager ();
666
668
auto Loc = D->getBody ()->getLocStart ();
667
- if (CGM.getContext ().getSourceManager ().isInSystemHeader (Loc))
669
+ return SM.isInSystemHeader (Loc);
670
+ }
671
+
672
+ void CodeGenPGO::emitCounterRegionMapping (const Decl *D) {
673
+ if (skipRegionMappingForDecl (D))
668
674
return ;
669
675
670
676
std::string CoverageMapping;
@@ -685,11 +691,7 @@ void CodeGenPGO::emitCounterRegionMapping(const Decl *D) {
685
691
void
686
692
CodeGenPGO::emitEmptyCounterMapping (const Decl *D, StringRef Name,
687
693
llvm::GlobalValue::LinkageTypes Linkage) {
688
- if (SkipCoverageMapping)
689
- return ;
690
- // Don't map the functions inside the system headers
691
- auto Loc = D->getBody ()->getLocStart ();
692
- if (CGM.getContext ().getSourceManager ().isInSystemHeader (Loc))
694
+ if (skipRegionMappingForDecl (D))
693
695
return ;
694
696
695
697
std::string CoverageMapping;
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ class CodeGenPGO {
103
103
llvm::Function *Fn);
104
104
void loadRegionCounts (llvm::IndexedInstrProfReader *PGOReader,
105
105
bool IsInMainFile);
106
+ bool skipRegionMappingForDecl (const Decl *D);
106
107
void emitCounterRegionMapping (const Decl *D);
107
108
108
109
public:
You can’t perform that action at this time.
0 commit comments