From: Vedant Kumar Date: Thu, 27 Jul 2017 02:20:20 +0000 (+0000) Subject: [Coverage] NFC: Save a pair of calls to get{Start,End} X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf6fe9b6196e0eea820482b67e16e48b2044e6fe;p=clang [Coverage] NFC: Save a pair of calls to get{Start,End} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309244 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index a1023473bd..11c57145f7 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -481,15 +481,17 @@ struct CounterCoverageMappingBuilder /// \brief Propagate counts through the children of \c S. Counter propagateCounts(Counter TopCount, const Stmt *S) { - size_t Index = pushRegion(TopCount, getStart(S), getEnd(S)); + SourceLocation StartLoc = getStart(S); + SourceLocation EndLoc = getEnd(S); + size_t Index = pushRegion(TopCount, StartLoc, EndLoc); Visit(S); Counter ExitCount = getRegion().getCounter(); popRegions(Index); // The statement may be spanned by an expansion. Make sure we handle a file // exit out of this expansion before moving to the next statement. - if (SM.isBeforeInTranslationUnit(getStart(S), S->getLocStart())) - MostRecentLocation = getEnd(S); + if (SM.isBeforeInTranslationUnit(StartLoc, S->getLocStart())) + MostRecentLocation = EndLoc; return ExitCount; }