[llvm] r273637 - Attempt to fix MSVC breakage caused by r273636.
George Burgess IV via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 18:41:30 PDT 2016
Author: gbiv
Date: Thu Jun 23 20:41:29 2016
New Revision: 273637
URL: http://llvm.org/viewvc/llvm-project?rev=273637&view=rev
Log:
Attempt to fix MSVC breakage caused by r273636.
Apparently earlier versions of MSVC don't have constexpr bitset ctors.
Modified:
llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp?rev=273637&r1=273636&r2=273637&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp Thu Jun 23 20:41:29 2016
@@ -142,13 +142,17 @@ LLVM_CONSTEXPR unsigned AttrFirstArgInde
LLVM_CONSTEXPR unsigned AttrLastArgIndex = MaxStratifiedAttrIndex;
LLVM_CONSTEXPR unsigned AttrMaxNumArgs = AttrLastArgIndex - AttrFirstArgIndex;
-LLVM_CONSTEXPR StratifiedAttrs AttrNone = 0;
-LLVM_CONSTEXPR StratifiedAttrs AttrEscaped = 1 << AttrEscapedIndex;
-LLVM_CONSTEXPR StratifiedAttrs AttrUnknown = 1 << AttrUnknownIndex;
-LLVM_CONSTEXPR StratifiedAttrs AttrGlobal = 1 << AttrGlobalIndex;
-LLVM_CONSTEXPR StratifiedAttrs AttrCaller = 1 << AttrCallerIndex;
-LLVM_CONSTEXPR StratifiedAttrs ExternalAttrMask =
- (1 << AttrEscapedIndex) | (1 << AttrUnknownIndex) | (1 << AttrGlobalIndex);
+// NOTE: These aren't StratifiedAttrs because bitsets don't have a constexpr
+// ctor for some versions of MSVC that we support. We could maybe refactor,
+// but...
+using StratifiedAttr = unsigned;
+LLVM_CONSTEXPR StratifiedAttr AttrNone = 0;
+LLVM_CONSTEXPR StratifiedAttr AttrEscaped = 1 << AttrEscapedIndex;
+LLVM_CONSTEXPR StratifiedAttr AttrUnknown = 1 << AttrUnknownIndex;
+LLVM_CONSTEXPR StratifiedAttr AttrGlobal = 1 << AttrGlobalIndex;
+LLVM_CONSTEXPR StratifiedAttr AttrCaller = 1 << AttrCallerIndex;
+LLVM_CONSTEXPR StratifiedAttr ExternalAttrMask =
+ AttrEscaped | AttrUnknown | AttrGlobal;
/// The maximum number of arguments we can put into a summary.
LLVM_CONSTEXPR unsigned MaxSupportedArgsInSummary = 50;
@@ -744,7 +748,7 @@ static bool isUnknownAttr(StratifiedAttr
static Optional<StratifiedAttrs> valueToAttr(Value *Val) {
if (isa<GlobalValue>(Val))
- return AttrGlobal;
+ return StratifiedAttrs(AttrGlobal);
if (auto *Arg = dyn_cast<Argument>(Val))
// Only pointer arguments should have the argument attribute,
@@ -827,7 +831,7 @@ CFLAAResult::FunctionInfo::FunctionInfo(
auto &Link = Sets.getLink(SetIndex);
InterfaceMap.insert(std::make_pair(SetIndex, CurrValue));
- auto ExternalAttrs = Link.Attrs & ExternalAttrMask;
+ auto ExternalAttrs = Link.Attrs & StratifiedAttrs(ExternalAttrMask);
if (ExternalAttrs.any())
RetParamAttributes.push_back(
ExternalAttribute{CurrValue, ExternalAttrs});
More information about the llvm-commits
mailing list