//===--- CGVtable.cpp - Emit LLVM Code for C++ vtables --------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This contains code dealing with C++ code generation of virtual tables.
//
//===----------------------------------------------------------------------===//
#include "CodeGenModule.h"
#include "CodeGenFunction.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecordLayout.h"
#include "llvm/ADT/DenseSet.h"
#include <cstdio>
using namespace clang;
using namespace CodeGen;
namespace {
class VtableBuilder {
public:
/// Index_t - Vtable index type.
typedef uint64_t Index_t;
typedef std::vector<std::pair<GlobalDecl,
std::pair<GlobalDecl, ThunkAdjustment> > >
SavedAdjustmentsVectorTy;
private:
// VtableComponents - The components of the vtable being built.
typedef llvm::SmallVector<llvm::Constant *, 64> VtableComponentsVectorTy;
VtableComponentsVectorTy VtableComponents;
const bool BuildVtable;
llvm::Type *Ptr8Ty;
/// MostDerivedClass - The most derived class that this vtable is being
/// built for.
const CXXRecordDecl *MostDerivedClass;
/// LayoutClass - The most derived class used for virtual base layout
/// information.
const CXXRecordDecl