]> granicus.if.org Git - clang/commitdiff
[Coverage] NFC: Save a pair of calls to get{Start,End}
authorVedant Kumar <vsk@apple.com>
Thu, 27 Jul 2017 02:20:20 +0000 (02:20 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 27 Jul 2017 02:20:20 +0000 (02:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309244 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CoverageMappingGen.cpp

index a1023473bdd33daeea9140f178a6d39722e7513f..11c57145f780c9f689067edd52ca014b3bff0eaa 100644 (file)
@@ -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;
   }