summaryrefslogtreecommitdiff
path: root/lib/Target/CppBackend
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-12-07 19:34:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-12-07 19:34:20 +0000
commitf7f74c22b1470aa62e891010fc1fb9f7879ab232 (patch)
tree2442e799f89cf5059c517a1a81e509faedd28354 /lib/Target/CppBackend
parentdfe327f749337906c2a60d807ac24b47caaf6273 (diff)
downloadllvm-f7f74c22b1470aa62e891010fc1fb9f7879ab232.tar.gz
llvm-f7f74c22b1470aa62e891010fc1fb9f7879ab232.tar.bz2
llvm-f7f74c22b1470aa62e891010fc1fb9f7879ab232.tar.xz
Remove the notion of primitive types.
They were out of place since the introduction of arbitrary precision integer types. This also synchronizes the documentation to Types.h, so it refers to first class types and single value types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend')
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index ddc7a66c9f..07a9db35a1 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -361,25 +361,25 @@ void CppWriter::printEscapedString(const std::string &Str) {
}
std::string CppWriter::getCppName(Type* Ty) {
- // First, handle the primitive types .. easy
- if (Ty->isPrimitiveType() || Ty->isIntegerTy()) {
- switch (Ty->getTypeID()) {
- case Type::VoidTyID: return "Type::getVoidTy(mod->getContext())";
- case Type::IntegerTyID: {
- unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
- return "IntegerType::get(mod->getContext(), " + utostr(BitWidth) + ")";
- }
- case Type::X86_FP80TyID: return "Type::getX86_FP80Ty(mod->getContext())";
- case Type::FloatTyID: return "Type::getFloatTy(mod->getContext())";
- case Type::DoubleTyID: return "Type::getDoubleTy(mod->getContext())";
- case Type::LabelTyID: return "Type::getLabelTy(mod->getContext())";
- case Type::X86_MMXTyID: return "Type::getX86_MMXTy(mod->getContext())";
- default:
- error("Invalid primitive type");
- break;
- }
- // shouldn't be returned, but make it sensible
+ switch (Ty->getTypeID()) {
+ default:
+ break;
+ case Type::VoidTyID:
return "Type::getVoidTy(mod->getContext())";
+ case Type::IntegerTyID: {
+ unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
+ return "IntegerType::get(mod->getContext(), " + utostr(BitWidth) + ")";
+ }
+ case Type::X86_FP80TyID:
+ return "Type::getX86_FP80Ty(mod->getContext())";
+ case Type::FloatTyID:
+ return "Type::getFloatTy(mod->getContext())";
+ case Type::DoubleTyID:
+ return "Type::getDoubleTy(mod->getContext())";
+ case Type::LabelTyID:
+ return "Type::getLabelTy(mod->getContext())";
+ case Type::X86_MMXTyID:
+ return "Type::getX86_MMXTy(mod->getContext())";
}
// Now, see if we've seen the type before and return that
@@ -537,7 +537,8 @@ void CppWriter::printAttributes(const AttributeSet &PAL,
void CppWriter::printType(Type* Ty) {
// We don't print definitions for primitive types
- if (Ty->isPrimitiveType() || Ty->isIntegerTy())
+ if (Ty->isFloatingPointTy() || Ty->isX86_MMXTy() || Ty->isIntegerTy() ||
+ Ty->isLabelTy() || Ty->isMetadataTy() || Ty->isVoidTy())
return;
// If we already defined this type, we don't need to define it again.