summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGRtti.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
commit9092c3e0fa01f3139b016d05d267a89e3b07747a (patch)
tree137ebebcae16fb0ce7ab4af456992bbd8d22fced /lib/CodeGen/CGRtti.cpp
parent4981926bf654fe5a2c3893f24ca44106b217e71e (diff)
downloadFreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.zip
FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.tar.gz
Update clang to r84119.
Diffstat (limited to 'lib/CodeGen/CGRtti.cpp')
-rw-r--r--lib/CodeGen/CGRtti.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/CodeGen/CGRtti.cpp b/lib/CodeGen/CGRtti.cpp
new file mode 100644
index 0000000..7bc774f
--- /dev/null
+++ b/lib/CodeGen/CGRtti.cpp
@@ -0,0 +1,47 @@
+//===--- CGCXXRtti.cpp - Emit LLVM Code for C++ RTTI descriptors ----------===//
+//
+// 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 RTTI descriptors.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CodeGenModule.h"
+using namespace clang;
+using namespace CodeGen;
+
+llvm::Constant *CodeGenModule::GenerateRtti(const CXXRecordDecl *RD) {
+ llvm::Type *Ptr8Ty;
+ Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
+ llvm::Constant *Rtti = llvm::Constant::getNullValue(Ptr8Ty);
+
+ if (!getContext().getLangOptions().Rtti)
+ return Rtti;
+
+ llvm::SmallString<256> OutName;
+ llvm::raw_svector_ostream Out(OutName);
+ mangleCXXRtti(getMangleContext(), RD, Out);
+
+ llvm::GlobalVariable::LinkageTypes linktype;
+ linktype = llvm::GlobalValue::WeakAnyLinkage;
+ std::vector<llvm::Constant *> info;
+ // assert(0 && "FIXME: implement rtti descriptor");
+ // FIXME: descriptor
+ info.push_back(llvm::Constant::getNullValue(Ptr8Ty));
+ // assert(0 && "FIXME: implement rtti ts");
+ // FIXME: TS
+ info.push_back(llvm::Constant::getNullValue(Ptr8Ty));
+
+ llvm::Constant *C;
+ llvm::ArrayType *type = llvm::ArrayType::get(Ptr8Ty, info.size());
+ C = llvm::ConstantArray::get(type, info);
+ Rtti = new llvm::GlobalVariable(getModule(), type, true, linktype, C,
+ Out.str());
+ Rtti = llvm::ConstantExpr::getBitCast(Rtti, Ptr8Ty);
+ return Rtti;
+}
OpenPOWER on IntegriCloud