[clang] 4544a63 - Move variable only used in an assert into the assert.

Sterling Augustine via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 18 13:11:18 PST 2021


Author: Sterling Augustine
Date: 2021-02-18T13:04:58-08:00
New Revision: 4544a63b77056212af341722b2e04471a8ec0be6

URL: https://github.com/llvm/llvm-project/commit/4544a63b77056212af341722b2e04471a8ec0be6
DIFF: https://github.com/llvm/llvm-project/commit/4544a63b77056212af341722b2e04471a8ec0be6.diff

LOG: Move variable only used in an assert into the assert.

This prevents unused variable warnings when building without asserts.

Added: 
    

Modified: 
    clang/lib/CodeGen/CoverageMappingGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index ce2cb380e0c1..519b9ad4bdbd 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -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());


        


More information about the cfe-commits mailing list