Some cleanups for compilation with GCC 4.0.0 to remove warnings:

* Use C++ style casts, not C style casts
* Abstract base classes should have virtual destructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22057 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2005-05-15 16:13:11 +00:00
parent 98a493c7ce
commit edd5d9ece1
8 changed files with 18 additions and 12 deletions

View File

@ -60,7 +60,7 @@ public:
// Make sure that any clients of this file link in PostDominators.cpp
static IncludeFile
FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub);
FIND_USED_TYPES_INCLUDE_FILE(reinterpret_cast<void*>(&FindUsedTypes::stub));
} // End llvm namespace

View File

@ -230,7 +230,8 @@ public:
/// block is in no loop (for example the entry node), null is returned.
///
Loop *getLoopFor(const BasicBlock *BB) const {
std::map<BasicBlock *, Loop*>::const_iterator I=BBMap.find((BasicBlock*)BB);
std::map<BasicBlock *, Loop*>::const_iterator I=
BBMap.find(const_cast<BasicBlock*>(BB));
return I != BBMap.end() ? I->second : 0;
}
@ -300,7 +301,7 @@ private:
// Make sure that any clients of this file link in LoopInfo.cpp
static IncludeFile
LOOP_INFO_INCLUDE_FILE((void*)&LoopInfo::stub);
LOOP_INFO_INCLUDE_FILE(reinterpret_cast<void*>(&LoopInfo::stub));
// Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const Loop*> {

View File

@ -27,6 +27,8 @@ class Instruction;
struct AssemblyAnnotationWriter {
virtual ~AssemblyAnnotationWriter();
// emitFunctionAnnot - This may be implemented to emit a string right before
// the start of a function.
virtual void emitFunctionAnnot(const Function *F, std::ostream &OS) {}

View File

@ -141,7 +141,7 @@ public:
/// getNumParams - Return the number of fixed parameters this function type
/// requires. This does not consider varargs.
///
unsigned getNumParams() const { return (unsigned)ContainedTys.size()-1; }
unsigned getNumParams() const { return unsigned(ContainedTys.size()-1); }
// Implement the AbstractTypeUser interface.
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
@ -207,7 +207,7 @@ public:
element_iterator element_end() const { return ContainedTys.end(); }
// Random access to the elements
unsigned getNumElements() const { return (unsigned)ContainedTys.size(); }
unsigned getNumElements() const { return unsigned(ContainedTys.size()); }
const Type *getElementType(unsigned N) const {
assert(N < ContainedTys.size() && "Element number out of range!");
return ContainedTys[N];

View File

@ -519,7 +519,7 @@ public:
/// if it is a direct call. If it is a call through a function pointer,
/// return null.
Function *getCalledFunction() const {
return (Function*)dyn_cast<Function>(getOperand(0));
return static_cast<Function*>(dyn_cast<Function>(getOperand(0)));
}
// getCalledValue - Get a pointer to a method that is invoked by this inst.
@ -1153,7 +1153,7 @@ public:
// successor.
inline ConstantInt *getSuccessorValue(unsigned idx) const {
assert(idx < getNumSuccessors() && "Successor # out of range!");
return (ConstantInt*)getOperand(idx*2);
return reinterpret_cast<ConstantInt*>(getOperand(idx*2));
}
// Methods for support type inquiry through isa, cast, and dyn_cast:

View File

@ -32,8 +32,8 @@ class CallSite {
Instruction *I;
public:
CallSite() : I(0) {}
CallSite(CallInst *CI) : I((Instruction*)CI) {}
CallSite(InvokeInst *II) : I((Instruction*)II) {}
CallSite(CallInst *CI) : I(reinterpret_cast<Instruction*>(CI)) {}
CallSite(InvokeInst *II) : I(reinterpret_cast<Instruction*>(II)) {}
CallSite(const CallSite &CS) : I(CS.I) {}
CallSite &operator=(const CallSite &CS) { I = CS.I; return *this; }
@ -45,9 +45,9 @@ public:
static CallSite get(Value *V) {
if (Instruction *I = dyn_cast<Instruction>(V)) {
if (I->getOpcode() == Instruction::Call)
return CallSite((CallInst*)I);
return CallSite(reinterpret_cast<CallInst*>(I));
else if (I->getOpcode() == Instruction::Invoke)
return CallSite((InvokeInst*)I);
return CallSite(reinterpret_cast<InvokeInst*>(I));
}
return CallSite();
}

View File

@ -108,7 +108,7 @@ public:
inline bool isEmpty() const { return pmap.empty() && tmap.empty(); }
/// @brief The number of name/type pairs is returned.
inline unsigned num_types() const { return (unsigned)tmap.size(); }
inline unsigned num_types() const { return unsigned(tmap.size()); }
/// Given a base name, return a string that is either equal to it or
/// derived from it that does not already occur in the symbol table

View File

@ -34,6 +34,9 @@ using namespace llvm;
namespace llvm {
// Make virtual table appear in this compilation unit.
AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
/// This class provides computation of slot numbers for LLVM Assembly writing.
/// @brief LLVM Assembly Writing Slot Computation.
class SlotMachine {