aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-10-18 22:28:37 +0000
committerJohn McCall <rjmccall@apple.com>2011-10-18 22:28:37 +0000
commit2dde35bc626153492f5f58202506c88a27fbff5b (patch)
tree339ef89cb3aef4f0e23a575811a379b37aed4793
parentc705d2520a51de1dc38d36efada8e9bc2d8b0d1f (diff)
downloadclang-2dde35bc626153492f5f58202506c88a27fbff5b.tar.gz
More metaprogramming with builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142433 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/PrintfFormatString.cpp24
-rw-r--r--lib/CodeGen/CGRTTI.cpp8
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp8
-rw-r--r--tools/libclang/CIndex.cpp34
-rw-r--r--tools/libclang/CIndexUSRs.cpp7
5 files changed, 27 insertions, 54 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 4e3e391fd0..affc83e7ef 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -372,11 +372,9 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt) {
}
// We can only work with builtin types.
- if (!QT->isBuiltinType())
- return false;
-
- // Everything else should be a base type
const BuiltinType *BT = QT->getAs<BuiltinType>();
+ if (!BT)
+ return false;
// Set length modifier
switch (BT->getKind()) {
@@ -388,19 +386,15 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt) {
case BuiltinType::UInt128:
case BuiltinType::Int128:
case BuiltinType::Half:
- // Integral types which are non-trivial to correct.
+ // Various types which are non-trivial to correct.
return false;
- case BuiltinType::Void:
- case BuiltinType::NullPtr:
- case BuiltinType::ObjCId:
- case BuiltinType::ObjCClass:
- case BuiltinType::ObjCSel:
- case BuiltinType::Dependent:
- case BuiltinType::Overload:
- case BuiltinType::BoundMember:
- case BuiltinType::UnknownAny:
- case BuiltinType::ARCUnbridgedCast:
+#define SIGNED_TYPE(Id, SingletonId)
+#define UNSIGNED_TYPE(Id, SingletonId)
+#define FLOATING_TYPE(Id, SingletonId)
+#define BUILTIN_TYPE(Id, SingletonId) \
+ case BuiltinType::Id:
+#include "clang/AST/BuiltinTypes.def"
// Misc other stuff which doesn't make sense here.
return false;
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index c4526fc4cf..1b3cb08284 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -195,11 +195,11 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
case BuiltinType::UInt128:
return true;
- case BuiltinType::Overload:
case BuiltinType::Dependent:
- case BuiltinType::BoundMember:
- case BuiltinType::UnknownAny:
- case BuiltinType::ARCUnbridgedCast:
+#define BUILTIN_TYPE(Id, SingletonId)
+#define PLACEHOLDER_TYPE(Id, SingletonId) \
+ case BuiltinType::Id:
+#include "clang/AST/BuiltinTypes.def"
llvm_unreachable("asking for RRTI for a placeholder type!");
case BuiltinType::ObjCId:
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 3bb5d8a90f..578695009b 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -368,11 +368,11 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
ResultType = llvm::IntegerType::get(getLLVMContext(), 128);
break;
- case BuiltinType::Overload:
case BuiltinType::Dependent:
- case BuiltinType::BoundMember:
- case BuiltinType::UnknownAny:
- case BuiltinType::ARCUnbridgedCast:
+#define BUILTIN_TYPE(Id, SingletonId)
+#define PLACEHOLDER_TYPE(Id, SingletonId) \
+ case BuiltinType::Id:
+#include "clang/AST/BuiltinTypes.def"
llvm_unreachable("Unexpected placeholder builtin type!");
break;
}
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 3130a029e7..17b2316bed 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1344,36 +1344,16 @@ bool CursorVisitor::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
// "Class") have associated declarations. Create cursors for those.
QualType VisitType;
switch (TL.getTypePtr()->getKind()) {
+
case BuiltinType::Void:
- case BuiltinType::Bool:
- case BuiltinType::Char_U:
- case BuiltinType::UChar:
- case BuiltinType::Char16:
- case BuiltinType::Char32:
- case BuiltinType::UShort:
- case BuiltinType::UInt:
- case BuiltinType::ULong:
- case BuiltinType::ULongLong:
- case BuiltinType::UInt128:
- case BuiltinType::Char_S:
- case BuiltinType::SChar:
- case BuiltinType::WChar_U:
- case BuiltinType::WChar_S:
- case BuiltinType::Short:
- case BuiltinType::Int:
- case BuiltinType::Long:
- case BuiltinType::LongLong:
- case BuiltinType::Int128:
- case BuiltinType::Half:
- case BuiltinType::Float:
- case BuiltinType::Double:
- case BuiltinType::LongDouble:
case BuiltinType::NullPtr:
- case BuiltinType::Overload:
- case BuiltinType::BoundMember:
case BuiltinType::Dependent:
- case BuiltinType::UnknownAny:
- case BuiltinType::ARCUnbridgedCast:
+#define BUILTIN_TYPE(Id, SingletonId)
+#define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
+#define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
+#define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
+#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
+#include "clang/AST/BuiltinTypes.def"
break;
case BuiltinType::ObjCId:
diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp
index f6e9aa358e..1219c2eea1 100644
--- a/tools/libclang/CIndexUSRs.cpp
+++ b/tools/libclang/CIndexUSRs.cpp
@@ -578,11 +578,10 @@ void USRGenerator::VisitType(QualType T) {
c = 'D'; break;
case BuiltinType::NullPtr:
c = 'n'; break;
- case BuiltinType::Overload:
- case BuiltinType::BoundMember:
+#define BUILTIN_TYPE(Id, SingletonId)
+#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
+#include "clang/AST/BuiltinTypes.def"
case BuiltinType::Dependent:
- case BuiltinType::UnknownAny:
- case BuiltinType::ARCUnbridgedCast:
IgnoreResults = true;
return;
case BuiltinType::ObjCId: