Rearrange code to eliminate warnings
[oota-llvm.git] / include / llvm / InstrTypes.h
index 4c6f1441e3f7fe42ea73121fda162a26ca5eac3e..30ba130b892f68490fa820a263c2fe12c52509d0 100644 (file)
@@ -1,4 +1,11 @@
 //===-- llvm/InstrTypes.h - Important Instruction subclasses ----*- C++ -*-===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file defines various meta classes of instructions that exist in the VM
 // representation.  Specific concrete subclasses of these may be found in the 
@@ -11,6 +18,8 @@
 
 #include "llvm/Instruction.h"
 
+namespace llvm {
+
 //===----------------------------------------------------------------------===//
 //                            TerminatorInst Class
 //===----------------------------------------------------------------------===//
@@ -25,6 +34,7 @@ protected:
                  const std::string &Name = "", Instruction *InsertBefore = 0)
     : Instruction(Ty, iType, Name, InsertBefore) {
   }
+  TerminatorInst(Instruction::TermOps iType, BasicBlock *InsertAtEnd);
 public:
 
   /// Terminators must implement the methods required by Instruction...
@@ -41,7 +51,8 @@ public:
   virtual void setSuccessor(unsigned idx, BasicBlock *B) = 0;
 
   inline BasicBlock *getSuccessor(unsigned idx) {
-    return (BasicBlock*)((const TerminatorInst *)this)->getSuccessor(idx);
+    const TerminatorInst *TI = this;
+    return const_cast<BasicBlock*>(TI->getSuccessor(idx));
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -101,7 +112,7 @@ public:
   static       Value*    getNotArgument(      BinaryOperator* Bop);
 
   BinaryOps getOpcode() const { 
-    return (BinaryOps)Instruction::getOpcode();
+    return static_cast<BinaryOps>(Instruction::getOpcode());
   }
 
   virtual Instruction *clone() const {
@@ -127,4 +138,6 @@ public:
   }
 };
 
+} // End llvm namespace
+
 #endif