forked from OSchip/llvm-project
Make some LLVM_CONSTEXPR variables const. NFC.
This patch changes LLVM_CONSTEXPR variable declarations to const variable declarations, since LLVM_CONSTEXPR expands to nothing if the current compiler doesn't support constexpr. In all of the changed cases, it looks like the code intended the variable to be const instead of sometimes-constexpr sometimes-not. llvm-svn: 279696
This commit is contained in:
parent
1804a77b2a
commit
381fc0ee3c
|
@ -7,25 +7,24 @@ namespace llvm {
|
|||
namespace cflaa {
|
||||
|
||||
namespace {
|
||||
LLVM_CONSTEXPR unsigned AttrEscapedIndex = 0;
|
||||
LLVM_CONSTEXPR unsigned AttrUnknownIndex = 1;
|
||||
LLVM_CONSTEXPR unsigned AttrGlobalIndex = 2;
|
||||
LLVM_CONSTEXPR unsigned AttrCallerIndex = 3;
|
||||
LLVM_CONSTEXPR unsigned AttrFirstArgIndex = 4;
|
||||
LLVM_CONSTEXPR unsigned AttrLastArgIndex = NumAliasAttrs;
|
||||
LLVM_CONSTEXPR unsigned AttrMaxNumArgs = AttrLastArgIndex - AttrFirstArgIndex;
|
||||
const unsigned AttrEscapedIndex = 0;
|
||||
const unsigned AttrUnknownIndex = 1;
|
||||
const unsigned AttrGlobalIndex = 2;
|
||||
const unsigned AttrCallerIndex = 3;
|
||||
const unsigned AttrFirstArgIndex = 4;
|
||||
const unsigned AttrLastArgIndex = NumAliasAttrs;
|
||||
const unsigned AttrMaxNumArgs = AttrLastArgIndex - AttrFirstArgIndex;
|
||||
|
||||
// NOTE: These aren't AliasAttrs because bitsets don't have a constexpr
|
||||
// ctor for some versions of MSVC that we support. We could maybe refactor,
|
||||
// but...
|
||||
using AliasAttr = unsigned;
|
||||
LLVM_CONSTEXPR AliasAttr AttrNone = 0;
|
||||
LLVM_CONSTEXPR AliasAttr AttrEscaped = 1 << AttrEscapedIndex;
|
||||
LLVM_CONSTEXPR AliasAttr AttrUnknown = 1 << AttrUnknownIndex;
|
||||
LLVM_CONSTEXPR AliasAttr AttrGlobal = 1 << AttrGlobalIndex;
|
||||
LLVM_CONSTEXPR AliasAttr AttrCaller = 1 << AttrCallerIndex;
|
||||
LLVM_CONSTEXPR AliasAttr ExternalAttrMask =
|
||||
AttrEscaped | AttrUnknown | AttrGlobal;
|
||||
const AliasAttr AttrNone = 0;
|
||||
const AliasAttr AttrEscaped = 1 << AttrEscapedIndex;
|
||||
const AliasAttr AttrUnknown = 1 << AttrUnknownIndex;
|
||||
const AliasAttr AttrGlobal = 1 << AttrGlobalIndex;
|
||||
const AliasAttr AttrCaller = 1 << AttrCallerIndex;
|
||||
const AliasAttr ExternalAttrMask = AttrEscaped | AttrUnknown | AttrGlobal;
|
||||
}
|
||||
|
||||
AliasAttrs getAttrNone() { return AttrNone; }
|
||||
|
|
|
@ -99,7 +99,7 @@ AliasAttrs getExternallyVisibleAttrs(AliasAttrs);
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// The maximum number of arguments we can put into a summary.
|
||||
LLVM_CONSTEXPR static unsigned MaxSupportedArgsInSummary = 50;
|
||||
static const unsigned MaxSupportedArgsInSummary = 50;
|
||||
|
||||
/// We use InterfaceValue to describe parameters/return value, as well as
|
||||
/// potential memory locations that are pointed to by parameters/return value,
|
||||
|
@ -137,7 +137,7 @@ inline bool operator>=(InterfaceValue LHS, InterfaceValue RHS) {
|
|||
// We use UnknownOffset to represent pointer offsets that cannot be determined
|
||||
// at compile time. Note that MemoryLocation::UnknownSize cannot be used here
|
||||
// because we require a signed value.
|
||||
static LLVM_CONSTEXPR int64_t UnknownOffset = INT64_MAX;
|
||||
static const int64_t UnknownOffset = INT64_MAX;
|
||||
|
||||
inline int64_t addOffset(int64_t LHS, int64_t RHS) {
|
||||
if (LHS == UnknownOffset || RHS == UnknownOffset)
|
||||
|
|
|
@ -107,12 +107,10 @@ enum class MatchState : uint8_t {
|
|||
};
|
||||
|
||||
typedef std::bitset<7> StateSet;
|
||||
// N.B. These are unsigned instead of StateSets because some MSVC versions
|
||||
// apparently lack constexpr bitset ctors.
|
||||
LLVM_CONSTEXPR unsigned ReadOnlyStateMask =
|
||||
const unsigned ReadOnlyStateMask =
|
||||
(1U << static_cast<uint8_t>(MatchState::FlowFromReadOnly)) |
|
||||
(1U << static_cast<uint8_t>(MatchState::FlowFromMemAliasReadOnly));
|
||||
LLVM_CONSTEXPR unsigned WriteOnlyStateMask =
|
||||
const unsigned WriteOnlyStateMask =
|
||||
(1U << static_cast<uint8_t>(MatchState::FlowToWriteOnly)) |
|
||||
(1U << static_cast<uint8_t>(MatchState::FlowToMemAliasWriteOnly));
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ static Optional<AllocFnsTy> getAllocationData(const Value *V, AllocType AllocTy,
|
|||
// MallocLike is chosen here because allocsize makes no guarantees about the
|
||||
// nullness of the result of the function, nor does it deal with strings, nor
|
||||
// does it require that the memory returned is zeroed out.
|
||||
LLVM_CONSTEXPR auto AllocSizeAllocTy = MallocLike;
|
||||
const AllocType AllocSizeAllocTy = MallocLike;
|
||||
if ((AllocTy & AllocSizeAllocTy) == AllocSizeAllocTy &&
|
||||
Callee->hasFnAttribute(Attribute::AllocSize)) {
|
||||
Attribute Attr = Callee->getFnAttribute(Attribute::AllocSize);
|
||||
|
|
|
@ -196,7 +196,7 @@ const DIType *DbgVariable::getType() const {
|
|||
return Ty;
|
||||
}
|
||||
|
||||
static LLVM_CONSTEXPR DwarfAccelTable::Atom TypeAtoms[] = {
|
||||
static const DwarfAccelTable::Atom TypeAtoms[] = {
|
||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
|
||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
|
||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1)};
|
||||
|
|
|
@ -38,7 +38,7 @@ using namespace llvm;
|
|||
//
|
||||
// In order to do this, we need to reserve one value of the second (optional)
|
||||
// allocsize argument to signify "not present."
|
||||
LLVM_CONSTEXPR static unsigned AllocSizeNumElemsNotPresent = -1;
|
||||
static const unsigned AllocSizeNumElemsNotPresent = -1;
|
||||
|
||||
static uint64_t packAllocSizeArgs(unsigned ElemSizeArg,
|
||||
const Optional<unsigned> &NumElemsArg) {
|
||||
|
|
|
@ -1495,7 +1495,7 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r,
|
|||
assert(n>1 && "n must be > 1");
|
||||
|
||||
// b denotes the base of the number system. In our case b is 2^32.
|
||||
LLVM_CONSTEXPR uint64_t b = uint64_t(1) << 32;
|
||||
const uint64_t b = uint64_t(1) << 32;
|
||||
|
||||
DEBUG(dbgs() << "KnuthDiv: m=" << m << " n=" << n << '\n');
|
||||
DEBUG(dbgs() << "KnuthDiv: original:");
|
||||
|
|
|
@ -29,7 +29,7 @@ using namespace llvm;
|
|||
#define GET_INSTRINFO_CTOR_DTOR
|
||||
#include "AArch64GenInstrInfo.inc"
|
||||
|
||||
static LLVM_CONSTEXPR MachineMemOperand::Flags MOSuppressPair =
|
||||
static const MachineMemOperand::Flags MOSuppressPair =
|
||||
MachineMemOperand::MOTargetFlag1;
|
||||
|
||||
static cl::opt<unsigned>
|
||||
|
|
Loading…
Reference in New Issue