[IR] Cleanup EH instructions a little bit
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 23 Aug 2015 19:22:31 +0000 (19:22 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 23 Aug 2015 19:22:31 +0000 (19:22 +0000)
Just a cosmetic change, no functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245818 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Instructions.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/IR/Instructions.cpp

index f29639f95dc05fe637e1e6ba70452fcda5c13dda..f08ea71335128afad4fc41c831aa11d8ddf99e12 100644 (file)
@@ -3574,9 +3574,9 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ResumeInst, Value)
 //===----------------------------------------------------------------------===//
 
 class CatchEndPadInst : public TerminatorInst {
+private:
   CatchEndPadInst(const CatchEndPadInst &RI);
 
-private:
   void init(BasicBlock *UnwindBB);
   CatchEndPadInst(LLVMContext &C, BasicBlock *UnwindBB, unsigned Values,
                   Instruction *InsertBefore = nullptr);
@@ -3630,7 +3630,6 @@ private:
   unsigned getNumSuccessorsV() const override;
   void setSuccessorV(unsigned Idx, BasicBlock *B) override;
 
-private:
   // Shadow Instruction::setInstructionSubclassData with a private forwarding
   // method so that subclasses cannot accidentally use it.
   void setInstructionSubclassData(unsigned short D) {
@@ -3928,10 +3927,9 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CleanupPadInst, Value)
 class CatchReturnInst : public TerminatorInst {
   CatchReturnInst(const CatchReturnInst &RI);
 
-private:
   void init(CatchPadInst *CatchPad, BasicBlock *BB);
   CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
-                  Instruction *InsertBefore = nullptr);
+                  Instruction *InsertBefore);
   CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
                   BasicBlock *InsertAtEnd);
 
@@ -3996,20 +3994,15 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CatchReturnInst, Value)
 //===----------------------------------------------------------------------===//
 
 class CleanupReturnInst : public TerminatorInst {
+private:
   CleanupReturnInst(const CleanupReturnInst &RI);
 
-private:
   void init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB);
   CleanupReturnInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
                     unsigned Values, Instruction *InsertBefore = nullptr);
   CleanupReturnInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
                     unsigned Values, BasicBlock *InsertAtEnd);
 
-  int getUnwindLabelOpIdx() const {
-    assert(hasUnwindDest());
-    return 0;
-  }
-
 protected:
   // Note: Instruction needs to be a friend here to call cloneImpl.
   friend class Instruction;
index 7ede794bc760ecded96950abcf7771af306e0bfc..5cedfe86c1ba4090f62019b24d96213c0465582a 100644 (file)
@@ -3876,8 +3876,7 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
       }
       break;
     }
-    // CLEANUPRET: [val] or [val,bb#]
-    case bitc::FUNC_CODE_INST_CLEANUPRET: {
+    case bitc::FUNC_CODE_INST_CLEANUPRET: { // CLEANUPRET: [val] or [val,bb#]
       if (Record.size() != 1 && Record.size() != 2)
         return error("Invalid record");
       unsigned Idx = 0;
index e79fa415ffb209138393121e90fd10f95b520a3e..6b2cd6dac229317c572aec09a19a8a5650638f48 100644 (file)
@@ -682,7 +682,6 @@ CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI)
                      OperandTraits<CleanupReturnInst>::op_end(this) -
                          CRI.getNumOperands(),
                      CRI.getNumOperands()) {
-  SubclassOptionalData = CRI.SubclassOptionalData;
   setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
   Op<-1>() = CRI.Op<-1>();
   if (CRI.hasUnwindDest())
@@ -690,7 +689,6 @@ CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI)
 }
 
 void CleanupReturnInst::init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB) {
-  SubclassOptionalData = 0;
   if (UnwindBB)
     setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
 
@@ -740,14 +738,12 @@ CatchEndPadInst::CatchEndPadInst(const CatchEndPadInst &CRI)
                      OperandTraits<CatchEndPadInst>::op_end(this) -
                          CRI.getNumOperands(),
                      CRI.getNumOperands()) {
-  SubclassOptionalData = CRI.SubclassOptionalData;
   setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
   if (BasicBlock *UnwindDest = CRI.getUnwindDest())
     setUnwindDest(UnwindDest);
 }
 
 void CatchEndPadInst::init(BasicBlock *UnwindBB) {
-  SubclassOptionalData = 0;
   if (UnwindBB) {
     setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
     setUnwindDest(UnwindBB);
@@ -814,14 +810,14 @@ CatchReturnInst::CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
 }
 
 BasicBlock *CatchReturnInst::getSuccessorV(unsigned Idx) const {
-  assert(Idx == 0);
+  assert(Idx < getNumSuccessors() && "Successor # out of range for catchret!");
   return getSuccessor();
 }
 unsigned CatchReturnInst::getNumSuccessorsV() const {
   return getNumSuccessors();
 }
 void CatchReturnInst::setSuccessorV(unsigned Idx, BasicBlock *B) {
-  assert(Idx == 0);
+  assert(Idx < getNumSuccessors() && "Successor # out of range for catchret!");
   setSuccessor(B);
 }
 
@@ -879,7 +875,6 @@ void CatchPadInst::setSuccessorV(unsigned Idx, BasicBlock *B) {
 //                        TerminatePadInst Implementation
 //===----------------------------------------------------------------------===//
 void TerminatePadInst::init(BasicBlock *BB, ArrayRef<Value *> Args) {
-  SubclassOptionalData = 0;
   if (BB)
     setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
   if (BB)
@@ -892,7 +887,6 @@ TerminatePadInst::TerminatePadInst(const TerminatePadInst &TPI)
                      OperandTraits<TerminatePadInst>::op_end(this) -
                          TPI.getNumOperands(),
                      TPI.getNumOperands()) {
-  SubclassOptionalData = TPI.SubclassOptionalData;
   setInstructionSubclassData(TPI.getSubclassDataFromInstruction());
   std::copy(TPI.op_begin(), TPI.op_end(), op_begin());
 }