[clang] fc97a63 - Move a second variable only used in an assert into the assert.

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


Author: Sterling Augustine
Date: 2021-02-18T13:26:07-08:00
New Revision: fc97a63db0d3488ce6c422a9545f8b0268760918

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

LOG: Move a second 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 519b9ad4bdbd..72ed10d5c360 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -989,8 +989,8 @@ struct CounterCoverageMappingBuilder
         EndDepth--;
       }
       if (UnnestStart) {
-        SourceLocation NestedLoc = getEndOfFileOrMacro(AfterLoc);
-        assert(SM.isWrittenInSameFile(AfterLoc, NestedLoc));
+        assert(SM.isWrittenInSameFile(AfterLoc,
+                                      getEndOfFileOrMacro(AfterLoc)));
 
         AfterLoc = getIncludeOrExpansionLoc(AfterLoc);
         assert(AfterLoc.isValid());


        


More information about the cfe-commits mailing list