r300756 - [CodeGen] Use preincrement version of APInt::operator++ instead of postincrement to avoid creating and immediately discarding a temporary APInt.

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 19 14:02:45 PDT 2017


Author: ctopper
Date: Wed Apr 19 16:02:45 2017
New Revision: 300756

URL: http://llvm.org/viewvc/llvm-project?rev=300756&view=rev
Log:
[CodeGen] Use preincrement version of APInt::operator++ instead of postincrement to avoid creating and immediately discarding a temporary APInt.

This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207.


Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=300756&r1=300755&r2=300756&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Apr 19 16:02:45 2017
@@ -1166,7 +1166,7 @@ void CodeGenFunction::EmitCaseStmtRange(
       if (Rem)
         Rem--;
       SwitchInsn->addCase(Builder.getInt(LHS), CaseDest);
-      LHS++;
+      ++LHS;
     }
     return;
   }




More information about the cfe-commits mailing list