diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index c19321b5129..4eefdd72b7e 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -659,12 +659,18 @@ void CodeGenPGO::mapRegionCounters(const Decl *D) { FunctionHash = Walker.Hash.finalize(); } -void CodeGenPGO::emitCounterRegionMapping(const Decl *D) { +bool CodeGenPGO::skipRegionMappingForDecl(const Decl *D) { if (SkipCoverageMapping) - return; - // Don't map the functions inside the system headers + return true; + + // Don't map the functions in system headers. + const auto &SM = CGM.getContext().getSourceManager(); auto Loc = D->getBody()->getLocStart(); - if (CGM.getContext().getSourceManager().isInSystemHeader(Loc)) + return SM.isInSystemHeader(Loc); +} + +void CodeGenPGO::emitCounterRegionMapping(const Decl *D) { + if (skipRegionMappingForDecl(D)) return; std::string CoverageMapping; @@ -685,11 +691,7 @@ void CodeGenPGO::emitCounterRegionMapping(const Decl *D) { void CodeGenPGO::emitEmptyCounterMapping(const Decl *D, StringRef Name, llvm::GlobalValue::LinkageTypes Linkage) { - if (SkipCoverageMapping) - return; - // Don't map the functions inside the system headers - auto Loc = D->getBody()->getLocStart(); - if (CGM.getContext().getSourceManager().isInSystemHeader(Loc)) + if (skipRegionMappingForDecl(D)) return; std::string CoverageMapping; |