summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp20
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.h1
2 files changed, 12 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;
diff --git a/clang/lib/CodeGen/CodeGenPGO.h b/clang/lib/CodeGen/CodeGenPGO.h
index ccda5759e67..d03f23535bb 100644
--- a/clang/lib/CodeGen/CodeGenPGO.h
+++ b/clang/lib/CodeGen/CodeGenPGO.h
@@ -103,6 +103,7 @@ private:
llvm::Function *Fn);
void loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader,
bool IsInMainFile);
+ bool skipRegionMappingForDecl(const Decl *D);
void emitCounterRegionMapping(const Decl *D);
public:
OpenPOWER on IntegriCloud