From 750b1f5de2c34c4ed0ec4c791e9af238df845393 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sun, 6 Sep 2009 08:55:57 +0000 Subject: [PATCH] Public and private corrections, warned about by icc (#304). Patch by Erick Tryzelaar. llvm-svn: 81107 --- include/llvm/ADT/IndexedMap.h | 2 +- include/llvm/ADT/SparseBitVector.h | 2 +- include/llvm/ADT/ilist.h | 8 +++--- include/llvm/ADT/ilist_node.h | 2 +- include/llvm/Analysis/LibCallAliasAnalysis.h | 2 +- include/llvm/Constants.h | 8 +++--- include/llvm/GlobalAlias.h | 2 +- include/llvm/GlobalVariable.h | 2 +- include/llvm/InstrTypes.h | 6 ++--- include/llvm/Instructions.h | 26 ++++++++++---------- include/llvm/OperandTraits.h | 4 +-- include/llvm/Support/Recycler.h | 3 ++- include/llvm/Target/TargetRegisterInfo.h | 2 +- lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- lib/VMCore/ConstantsContext.h | 20 +++++++-------- lib/VMCore/Use.cpp | 2 +- lib/VMCore/Verifier.cpp | 2 +- 17 files changed, 48 insertions(+), 47 deletions(-) diff --git a/include/llvm/ADT/IndexedMap.h b/include/llvm/ADT/IndexedMap.h index ff5d3a139c7..89f0dfa64e1 100644 --- a/include/llvm/ADT/IndexedMap.h +++ b/include/llvm/ADT/IndexedMap.h @@ -26,7 +26,7 @@ namespace llvm { - struct IdentityFunctor : std::unary_function { + struct IdentityFunctor : public std::unary_function { unsigned operator()(unsigned Index) const { return Index; } diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 18a99cb0d8b..b7a6873001e 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -42,7 +42,7 @@ namespace llvm { template struct SparseBitVectorElement - : ilist_node > { + : public ilist_node > { public: typedef unsigned long BitWord; enum { diff --git a/include/llvm/ADT/ilist.h b/include/llvm/ADT/ilist.h index 6e6f5d69b68..b3824a217c7 100644 --- a/include/llvm/ADT/ilist.h +++ b/include/llvm/ADT/ilist.h @@ -121,15 +121,15 @@ struct ilist_node_traits { /// for all common operations. /// template -struct ilist_default_traits : ilist_nextprev_traits, - ilist_sentinel_traits, - ilist_node_traits { +struct ilist_default_traits : public ilist_nextprev_traits, + public ilist_sentinel_traits, + public ilist_node_traits { }; // Template traits for intrusive list. By specializing this template class, you // can change what next/prev fields are used to store the links... template -struct ilist_traits : ilist_default_traits {}; +struct ilist_traits : public ilist_default_traits {}; // Const traits are the same as nonconst traits... template diff --git a/include/llvm/ADT/ilist_node.h b/include/llvm/ADT/ilist_node.h index c28169fde5f..da25f959e61 100644 --- a/include/llvm/ADT/ilist_node.h +++ b/include/llvm/ADT/ilist_node.h @@ -40,7 +40,7 @@ struct ilist_nextprev_traits; /// that use ilist_nextprev_traits or ilist_default_traits. /// template -class ilist_node : ilist_half_node { +class ilist_node : private ilist_half_node { friend struct ilist_nextprev_traits; friend struct ilist_traits; NodeTy *Next; diff --git a/include/llvm/Analysis/LibCallAliasAnalysis.h b/include/llvm/Analysis/LibCallAliasAnalysis.h index ea17a237caa..7944af3b8a5 100644 --- a/include/llvm/Analysis/LibCallAliasAnalysis.h +++ b/include/llvm/Analysis/LibCallAliasAnalysis.h @@ -22,7 +22,7 @@ namespace llvm { struct LibCallFunctionInfo; /// LibCallAliasAnalysis - Alias analysis driven from LibCallInfo. - struct LibCallAliasAnalysis : public FunctionPass, AliasAnalysis { + struct LibCallAliasAnalysis : public FunctionPass, public AliasAnalysis { static char ID; // Class identification LibCallInfo *LCI; diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index da6fe96a772..871f0116d3c 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -397,7 +397,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<> { +struct OperandTraits : public VariadicOperandTraits<> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantArray, Constant) @@ -447,7 +447,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<> { +struct OperandTraits : public VariadicOperandTraits<> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantStruct, Constant) @@ -503,7 +503,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<> { +struct OperandTraits : public VariadicOperandTraits<> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantVector, Constant) @@ -795,7 +795,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<1> { +struct OperandTraits : public VariadicOperandTraits<1> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantExpr, Constant) diff --git a/include/llvm/GlobalAlias.h b/include/llvm/GlobalAlias.h index 91bd61b8380..9b3f4505697 100644 --- a/include/llvm/GlobalAlias.h +++ b/include/llvm/GlobalAlias.h @@ -88,7 +88,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<1> { +struct OperandTraits : public FixedNumOperandTraits<1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalAlias, Value) diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index f18554d53b5..56b2b9d3eba 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -151,7 +151,7 @@ public: }; template <> -struct OperandTraits : OptionalOperandTraits<> { +struct OperandTraits : public OptionalOperandTraits<> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalVariable, Value) diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 35d7534e5a3..b27863b53b6 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -130,7 +130,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<1> { +struct OperandTraits : public FixedNumOperandTraits<1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryInstruction, Value) @@ -298,7 +298,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryOperator, Value) @@ -711,7 +711,7 @@ public: // FIXME: these are redundant if CmpInst < BinaryOperator template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CmpInst, Value) diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 71f47385289..34f36d02535 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -363,7 +363,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(StoreInst, Value) @@ -613,7 +613,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<1> { +struct OperandTraits : public VariadicOperandTraits<1> { }; template @@ -1144,7 +1144,7 @@ public: }; template <> -struct OperandTraits : VariadicOperandTraits<1> { +struct OperandTraits : public VariadicOperandTraits<1> { }; template @@ -1241,7 +1241,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectInst, Value) @@ -1322,7 +1322,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value) @@ -1379,7 +1379,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementInst, Value) @@ -1435,7 +1435,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorInst, Value) @@ -1770,7 +1770,7 @@ public: }; template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; template @@ -1971,7 +1971,7 @@ public: }; template <> -struct OperandTraits : HungoffOperandTraits<2> { +struct OperandTraits : public HungoffOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(PHINode, Value) @@ -2047,7 +2047,7 @@ public: }; template <> -struct OperandTraits : OptionalOperandTraits<> { +struct OperandTraits : public OptionalOperandTraits<> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value) @@ -2155,7 +2155,7 @@ private: }; template <> -struct OperandTraits : VariadicOperandTraits<1> {}; +struct OperandTraits : public VariadicOperandTraits<1> {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BranchInst, Value) @@ -2304,7 +2304,7 @@ private: }; template <> -struct OperandTraits : HungoffOperandTraits<2> { +struct OperandTraits : public HungoffOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SwitchInst, Value) @@ -2522,7 +2522,7 @@ private: }; template <> -struct OperandTraits : VariadicOperandTraits<3> { +struct OperandTraits : public VariadicOperandTraits<3> { }; template diff --git a/include/llvm/OperandTraits.h b/include/llvm/OperandTraits.h index 3702a01b809..7c879c88f13 100644 --- a/include/llvm/OperandTraits.h +++ b/include/llvm/OperandTraits.h @@ -44,7 +44,7 @@ struct FixedNumOperandTraits { }; template struct Layout { - struct overlay : prefix, U { + struct overlay : public prefix, public U { overlay(); // DO NOT IMPLEMENT }; }; @@ -55,7 +55,7 @@ struct FixedNumOperandTraits { //===----------------------------------------------------------------------===// template -struct OptionalOperandTraits : FixedNumOperandTraits { +struct OptionalOperandTraits : public FixedNumOperandTraits { static unsigned operands(const User *U) { return U->getNumOperands(); } diff --git a/include/llvm/Support/Recycler.h b/include/llvm/Support/Recycler.h index 2fa0365d5f5..d8f8c789414 100644 --- a/include/llvm/Support/Recycler.h +++ b/include/llvm/Support/Recycler.h @@ -34,7 +34,8 @@ struct RecyclerStruct { }; template<> -struct ilist_traits : ilist_default_traits { +struct ilist_traits : + public ilist_default_traits { static RecyclerStruct *getPrev(const RecyclerStruct *t) { return t->Prev; } static RecyclerStruct *getNext(const RecyclerStruct *t) { return t->Next; } static void setPrev(RecyclerStruct *t, RecyclerStruct *p) { t->Prev = p; } diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index 421d0bbd281..80474240f4f 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -687,7 +687,7 @@ public: // This is useful when building IndexedMaps keyed on virtual registers -struct VirtReg2IndexFunctor : std::unary_function { +struct VirtReg2IndexFunctor : public std::unary_function { unsigned operator()(unsigned Reg) const { return Reg - TargetRegisterInfo::FirstVirtualRegister; } diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 9ed75ab1313..cb33dec6a02 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -161,7 +161,7 @@ namespace { // FIXME: can we inherit this from ConstantExpr? template <> -struct OperandTraits : FixedNumOperandTraits<1> { +struct OperandTraits : public FixedNumOperandTraits<1> { }; } diff --git a/lib/VMCore/ConstantsContext.h b/lib/VMCore/ConstantsContext.h index 718470aff42..d634c0b202c 100644 --- a/lib/VMCore/ConstantsContext.h +++ b/lib/VMCore/ConstantsContext.h @@ -235,54 +235,54 @@ struct CompareConstantExpr : public ConstantExpr { }; template <> -struct OperandTraits : FixedNumOperandTraits<1> { +struct OperandTraits : public FixedNumOperandTraits<1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<3> { +struct OperandTraits : public FixedNumOperandTraits<3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<1> { +struct OperandTraits : public FixedNumOperandTraits<1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractValueConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueConstantExpr, Value) template <> -struct OperandTraits : VariadicOperandTraits<1> { +struct OperandTraits : public VariadicOperandTraits<1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrConstantExpr, Value) template <> -struct OperandTraits : FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits<2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CompareConstantExpr, Value) diff --git a/lib/VMCore/Use.cpp b/lib/VMCore/Use.cpp index b25415a3d14..b7fd92f9b06 100644 --- a/lib/VMCore/Use.cpp +++ b/lib/VMCore/Use.cpp @@ -128,7 +128,7 @@ void Use::zap(Use *Start, const Use *Stop, bool del) { // AugmentedUse layout struct //===----------------------------------------------------------------------===// -struct AugmentedUse : Use { +struct AugmentedUse : public Use { PointerIntPair ref; AugmentedUse(); // not implemented }; diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index eed4e2d7a67..39f7faac432 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -106,7 +106,7 @@ static const PassInfo *const PreVerifyID = &PreVer; namespace { struct VISIBILITY_HIDDEN - Verifier : public FunctionPass, InstVisitor { + Verifier : public FunctionPass, public InstVisitor { static char ID; // Pass ID, replacement for typeid bool Broken; // Is this module found to be broken? bool RealPass; // Are we not being run by a PassManager?