[clang] 651f4ce - [clang][Interp][NFC] Use constexpr if when possible in Integral.h
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 7 22:31:59 PDT 2022
Author: Timm Bäder
Date: 2022-09-08T07:31:08+02:00
New Revision: 651f4ce7b186079e78de20d7de903112ea78d846
URL: https://github.com/llvm/llvm-project/commit/651f4ce7b186079e78de20d7de903112ea78d846
DIFF: https://github.com/llvm/llvm-project/commit/651f4ce7b186079e78de20d7de903112ea78d846.diff
LOG: [clang][Interp][NFC] Use constexpr if when possible in Integral.h
Added:
Modified:
clang/lib/AST/Interp/Integral.h
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Integral.h b/clang/lib/AST/Interp/Integral.h
index dc17df44282a..d2498fda6181 100644
--- a/clang/lib/AST/Interp/Integral.h
+++ b/clang/lib/AST/Interp/Integral.h
@@ -107,7 +107,7 @@ template <unsigned Bits, bool Signed> class Integral {
return APSInt(APInt(Bits, static_cast<uint64_t>(V), Signed), !Signed);
}
APSInt toAPSInt(unsigned NumBits) const {
- if (Signed)
+ if constexpr (Signed)
return APSInt(toAPSInt().sextOrTrunc(NumBits), !Signed);
else
return APSInt(toAPSInt().zextOrTrunc(NumBits), !Signed);
@@ -171,7 +171,7 @@ template <unsigned Bits, bool Signed> class Integral {
}
template <bool SrcSign> static Integral from(Integral<0, SrcSign> Value) {
- if (SrcSign)
+ if constexpr (SrcSign)
return Integral(Value.V.getSExtValue());
else
return Integral(Value.V.getZExtValue());
More information about the cfe-commits
mailing list