[clang] 4801757 - Move `SystemHeadersCoverage` into `llvm::coverage` in CoverageMappingGen.h
NAKAMURA Takumi via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 06:51:28 PDT 2024
Author: NAKAMURA Takumi
Date: 2024-07-09T22:21:20+09:00
New Revision: 48017579e523085bc3ee99004c36526333a3c8b3
URL: https://github.com/llvm/llvm-project/commit/48017579e523085bc3ee99004c36526333a3c8b3
DIFF: https://github.com/llvm/llvm-project/commit/48017579e523085bc3ee99004c36526333a3c8b3.diff
LOG: Move `SystemHeadersCoverage` into `llvm::coverage` in CoverageMappingGen.h
Part of #97952
Added:
Modified:
clang/lib/CodeGen/CodeGenPGO.cpp
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/CodeGen/CoverageMappingGen.h
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index ea726b5708a4a..6e6dfc4d5a642 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -32,8 +32,6 @@ static llvm::cl::opt<bool>
llvm::cl::desc("Enable value profiling"),
llvm::cl::Hidden, llvm::cl::init(false));
-extern llvm::cl::opt<bool> SystemHeadersCoverage;
-
using namespace clang;
using namespace CodeGen;
@@ -1118,7 +1116,7 @@ bool CodeGenPGO::skipRegionMappingForDecl(const Decl *D) {
// Don't map the functions in system headers.
const auto &SM = CGM.getContext().getSourceManager();
auto Loc = D->getBody()->getBeginLoc();
- return !SystemHeadersCoverage && SM.isInSystemHeader(Loc);
+ return !llvm::coverage::SystemHeadersCoverage && SM.isInSystemHeader(Loc);
}
void CodeGenPGO::emitCounterRegionMapping(const Decl *D) {
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index ba483d857d5f4..67a9caf8b4ec4 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -46,10 +46,12 @@ static llvm::cl::opt<bool> EmptyLineCommentCoverage(
"disable it on test)"),
llvm::cl::init(true), llvm::cl::Hidden);
-llvm::cl::opt<bool> SystemHeadersCoverage(
+namespace llvm::coverage {
+cl::opt<bool> SystemHeadersCoverage(
"system-headers-coverage",
- llvm::cl::desc("Enable collecting coverage from system headers"),
- llvm::cl::init(false), llvm::cl::Hidden);
+ cl::desc("Enable collecting coverage from system headers"), cl::init(false),
+ cl::Hidden);
+}
using namespace clang;
using namespace CodeGen;
diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h
index f7c59c48c1839..fe4b93f3af856 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.h
+++ b/clang/lib/CodeGen/CoverageMappingGen.h
@@ -19,8 +19,13 @@
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/GlobalValue.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
+namespace llvm::coverage {
+extern cl::opt<bool> SystemHeadersCoverage;
+}
+
namespace clang {
class LangOptions;
More information about the cfe-commits
mailing list