//===- MCFixup.cpp - Assembly Fixup Implementation ------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/MC/MCFixup.h"
using namespace llvm;

static MCSymbolRefExpr::VariantKind getAccessVariant(const MCExpr *Expr) {
  switch (Expr->getKind()) {
  case MCExpr::Unary: {
    const MCUnaryExpr *UE = cast<MCUnaryExpr>(Expr);
    assert(getAccessVariant(UE->getSubExpr()) == MCSymbolRefExpr::VK_None);
    return MCSymbolRefExpr::VK_None;
  }

  case MCExpr::Target:
    llvm_unreachable("unsupported");

  case MCExpr::Constant:
    return MCSymbolRefExpr::VK_None;

  case MCExpr::SymbolRef: {
    const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(Expr);
    return SRE->getKind();
  }
  case MCExpr::Binary: {
    const MCBinaryExpr *ABE = cast<MCBinaryExpr>(Expr);
    assert(getAccessVariant(ABE->getRHS()) == MCSymbolRefExpr::VK_None);
    return getAccessVariant(ABE->getLHS());
  }
  }
  llvm_unreachable("unknown MCExpr kind");
}

MCSymbolRefExpr::VariantKind MCFixup::getAccessVariant() const {
  return ::getAccessVariant(getValue());
}

//===- MCFixup.cpp - Assembly Fixup Implementation ------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/MC/MCFixup.h"
using namespace llvm;

static MCSymbolRefExpr::VariantKind getAccessVariant(const MCExpr *Expr) {
  switch (Expr->getKind()) {
  case MCExpr::Unary: {
    assert(getAccessVariant(cast<MCUnaryExpr>(Expr)->getSubExpr()) ==
           MCSymbolRefExpr::VK_None);
    return MCSymbolRefExpr::VK_None;
  }

  case MCExpr::Target:
    llvm_unreachable("unsupported");

  case MCExpr::Constant:
    return MCSymbolRefExpr::VK_None;

  case MCExpr::SymbolRef: {
    const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(Expr);
    return SRE->getKind();
  }
  case MCExpr::Binary: {
    const MCBinaryExpr *ABE = cast<MCBinaryExpr>(Expr);
    assert(getAccessVariant(ABE->getRHS()) == MCSymbolRefExpr::VK_None);
    return getAccessVariant(ABE->getLHS());
  }
  }
  llvm_unreachable("unknown MCExpr kind");
}

MCSymbolRefExpr::VariantKind MCFixup::getAccessVariant() const {
  return ::getAccessVariant(getValue());
}

Remove a variable from r206192 that is only used in an assert.
Remove a variable from r206192 that is only used in an assert.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@206195 91177308-0d34-0410-b5e6-96231b3b80d8
