diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -24,7 +24,7 @@ namespace llvm { class FoldingSetNodeID; -template struct FoldingSetTrait; +template struct FoldingSetTrait; } // namespace llvm @@ -87,7 +87,7 @@ friend class ASTReader; friend class ASTWriter; friend class SourceManager; - friend struct llvm::FoldingSetTrait; + friend struct llvm::FoldingSetTrait; public: using UIntTy = uint32_t; @@ -507,7 +507,7 @@ }; // Allow calling FoldingSetNodeID::Add with SourceLocation object as parameter - template <> struct FoldingSetTrait { + template <> struct FoldingSetTrait { static void Profile(const clang::SourceLocation &X, FoldingSetNodeID &ID); }; diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp @@ -94,7 +94,7 @@ }; } -REGISTER_MAP_WITH_PROGRAMSTATE(SelfFlag, SymbolRef, unsigned) +REGISTER_MAP_WITH_PROGRAMSTATE(SelfFlag, SymbolRef, SelfFlagEnum) REGISTER_TRAIT_WITH_PROGRAMSTATE(CalledInit, bool) /// A call receiving a reference to 'self' invalidates the object that @@ -105,8 +105,8 @@ static SelfFlagEnum getSelfFlags(SVal val, ProgramStateRef state) { if (SymbolRef sym = val.getAsSymbol()) - if (const unsigned *attachedFlags = state->get(sym)) - return (SelfFlagEnum)*attachedFlags; + if (const SelfFlagEnum *attachedFlags = state->get(sym)) + return *attachedFlags; return SelfFlag_None; } @@ -118,7 +118,8 @@ SelfFlagEnum flag, CheckerContext &C) { // We tag the symbol that the SVal wraps. if (SymbolRef sym = val.getAsSymbol()) { - state = state->set(sym, getSelfFlags(val, state) | flag); + state = state->set(sym, + SelfFlagEnum(getSelfFlags(val, state) | flag)); C.addTransition(state); } } @@ -271,7 +272,7 @@ return; ProgramStateRef state = C.getState(); - SelfFlagEnum prevFlags = (SelfFlagEnum)state->get(); + SelfFlagEnum prevFlags = state->get(); if (!prevFlags) return; state = state->remove(); @@ -339,7 +340,7 @@ const char *NL, const char *Sep) const { SelfFlagTy FlagMap = State->get(); bool DidCallInit = State->get(); - SelfFlagEnum PreCallFlags = (SelfFlagEnum)State->get(); + SelfFlagEnum PreCallFlags = State->get(); if (FlagMap.isEmpty() && !DidCallInit && !PreCallFlags) return; diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h --- a/llvm/include/llvm/ADT/FoldingSet.h +++ b/llvm/include/llvm/ADT/FoldingSet.h @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace llvm { @@ -256,8 +257,8 @@ /// through template specialization the behavior can be tailored for specific /// types. Combined with the FoldingSetNodeWrapper class, one can add objects /// to FoldingSets that were not originally designed to have that behavior. -template struct FoldingSetTrait - : public DefaultFoldingSetTrait {}; +template +struct FoldingSetTrait : public DefaultFoldingSetTrait {}; /// DefaultContextualFoldingSetTrait - Like DefaultFoldingSetTrait, but /// for ContextualFoldingSets. @@ -828,6 +829,13 @@ } }; +template +struct FoldingSetTrait::value>> { + static void Profile(const T &X, FoldingSetNodeID &ID) { + ID.AddInteger(static_cast>(X)); + } +}; + } // end namespace llvm #endif // LLVM_ADT_FOLDINGSET_H diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -58,7 +58,7 @@ class Type; template struct GraphTraits; template class SmallSetVector; -template struct FoldingSetTrait; +template struct FoldingSetTrait; class AAResults; class BlockAddress; class BlockFrequencyInfo;