[clang][coverage] Introduce hasSkipCounter instead of getIsCounterPair (#178397)

The return value of `getIsCounterPair(S)` was `std::pair<bool,bool>` but
its `hasExec` wasn't used. So, introduce just the `hasSkipCounter(S)`.

It'd be better to name `getExecSkipCounterExistence` if
`std::pair<bool,bool>` would be resurrected in the future.
This commit is contained in:
NAKAMURA Takumi 2026-01-29 07:45:47 +09:00 committed by GitHub
parent e882aed1f9
commit 032accdce9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -1652,7 +1652,8 @@ private:
uint64_t LoopCount) const;
public:
std::pair<bool, bool> getIsCounterPair(const Stmt *S) const;
bool hasSkipCounter(const Stmt *S) const;
void markStmtAsUsed(bool Skipped, const Stmt *S);
void markStmtMaybeUsed(const Stmt *S);

View File

@ -1187,15 +1187,15 @@ CodeGenPGO::applyFunctionAttributes(llvm::IndexedInstrProfReader *PGOReader,
Fn->setEntryCount(FunctionCount);
}
std::pair<bool, bool> CodeGenPGO::getIsCounterPair(const Stmt *S) const {
bool CodeGenPGO::hasSkipCounter(const Stmt *S) const {
if (!RegionCounterMap)
return {false, false};
return false;
auto I = RegionCounterMap->find(S);
if (I == RegionCounterMap->end())
return {false, false};
return false;
return {I->second.Executed.hasValue(), I->second.Skipped.hasValue()};
return I->second.Skipped.hasValue();
}
void CodeGenPGO::emitCounterSetOrIncrement(CGBuilderTy &Builder, const Stmt *S,
@ -1567,8 +1567,8 @@ void CodeGenFunction::incrementProfileCounter(CounterForIncrement ExecSkip,
PGO->setCurrentStmt(S);
}
std::pair<bool, bool> CodeGenFunction::getIsCounterPair(const Stmt *S) const {
return PGO->getIsCounterPair(S);
bool CodeGenFunction::hasSkipCounter(const Stmt *S) const {
return PGO->hasSkipCounter(S);
}
void CodeGenFunction::markStmtAsUsed(bool Skipped, const Stmt *S) {
PGO->markStmtAsUsed(Skipped, S);

View File

@ -110,7 +110,7 @@ private:
bool canEmitMCDCCoverage(const CGBuilderTy &Builder);
public:
std::pair<bool, bool> getIsCounterPair(const Stmt *S) const;
bool hasSkipCounter(const Stmt *S) const;
bool isMCDCDecisionExpr(const Expr *E) const {
if (!RegionMCDCState)