[llvm] e31cfc4 - Fix -Wconstant-conversion warning with explicit cast

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 10:43:33 PDT 2020


Author: David Blaikie
Date: 2020-08-04T10:41:27-07:00
New Revision: e31cfc4cd3e393300002e9c519787c96e3b67bab

URL: https://github.com/llvm/llvm-project/commit/e31cfc4cd3e393300002e9c519787c96e3b67bab
DIFF: https://github.com/llvm/llvm-project/commit/e31cfc4cd3e393300002e9c519787c96e3b67bab.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.

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-commits mailing list