Move variable only used in an assert into the assert.
authorSterling Augustine <saugustine@google.com>
Thu, 18 Feb 2021 21:00:49 +0000 (13:00 -0800)
committerSterling Augustine <saugustine@google.com>
Thu, 18 Feb 2021 21:04:58 +0000 (13:04 -0800)
This prevents unused variable warnings when building without asserts.

clang/lib/CodeGen/CoverageMappingGen.cpp

index ce2cb380e0c1dcb6c8b96f7335152c5696c5daf8..519b9ad4bdbd956ea6634f0fb941091575237e5a 100644 (file)
@@ -981,8 +981,8 @@ struct CounterCoverageMappingBuilder
       bool UnnestStart = StartDepth >= EndDepth;
       bool UnnestEnd = EndDepth >= StartDepth;
       if (UnnestEnd) {
-        SourceLocation NestedLoc = getStartOfFileOrMacro(BeforeLoc);
-        assert(SM.isWrittenInSameFile(NestedLoc, BeforeLoc));
+        assert(SM.isWrittenInSameFile(getStartOfFileOrMacro(BeforeLoc),
+                                      BeforeLoc));
 
         BeforeLoc = getIncludeOrExpansionLoc(BeforeLoc);
         assert(BeforeLoc.isValid());