[llvm-branch-commits] [llvm] a318950 - Fix -Wconstant-conversion warning with explicit cast

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 17 05:06:14 PDT 2020


Author: David Blaikie
Date: 2020-08-17T14:01:44+02:00
New Revision: a318950c0f9b166245b3d912be2642af7584a078

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

LOG: Fix -Wconstant-conversion warning with explicit cast

Introduced by fd6584a22043b254a323635c142b28ce80ae5b5b

Following similar use of casts in AsmParser.cpp, for instance - ideally
this type would use unsigned chars as they're more representative of raw
data and don't get confused around implementation defined choices of
char's signedness, but this is what it is & the signed/unsigned
conversions are (so far as I understand) safe/bit preserving in this
usage and what's intended, given the API design here.

(cherry picked from commit e31cfc4cd3e393300002e9c519787c96e3b67bab)

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index 30666009801c..83653dcbb8cf 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -442,7 +442,7 @@ MCCFIInstruction AArch64FrameLowering::createDefCFAExpressionFromSP(
 
   // Build up the expression (SP + NumBytes + NumVGScaledBytes * AArch64::VG)
   SmallString<64> Expr;
-  Expr.push_back(dwarf::DW_OP_breg0 + /*SP*/ 31);
+  Expr.push_back((uint8_t)(dwarf::DW_OP_breg0 + /*SP*/ 31));
   Expr.push_back(0);
   appendVGScaledOffsetExpr(Expr, NumBytes, NumVGScaledBytes,
                            TRI.getDwarfRegNum(AArch64::VG, true), Comment);


        


More information about the llvm-branch-commits mailing list