[Lldb-commits] [lldb] r136536 - in /lldb/trunk: include/lldb/Symbol/ClangASTType.h source/Core/ValueObject.cpp source/Symbol/ClangASTType.cpp
Greg Clayton
gclayton at apple.com
Fri Jul 29 16:21:00 PDT 2011
Author: gclayton
Date: Fri Jul 29 18:21:00 2011
New Revision: 136536
URL: http://llvm.org/viewvc/llvm-project?rev=136536&view=rev
Log:
Moved some functionality from ValueObject to ClangASTType.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTType.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=136536&r1=136535&r2=136536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Fri Jul 29 18:21:00 2011
@@ -94,6 +94,12 @@
static size_t
GetTypeBitAlign (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+ lldb::LanguageType
+ GetMinimumLanguage ();
+
+ static lldb::LanguageType
+ GetMinimumLanguage (lldb::clang_type_t clang_type);
+
void
DumpValue (ExecutionContext *exe_ctx,
Stream *s,
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136536&r1=136535&r2=136536&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Jul 29 18:21:00 2011
@@ -1256,34 +1256,7 @@
lldb::LanguageType
ValueObject::GetObjectRuntimeLanguage ()
{
- clang_type_t opaque_qual_type = GetClangType();
- if (opaque_qual_type == NULL)
- return lldb::eLanguageTypeC;
-
- // If the type is a reference, then resolve it to what it refers to first:
- clang::QualType qual_type (clang::QualType::getFromOpaquePtr(opaque_qual_type).getNonReferenceType());
- if (qual_type->isAnyPointerType())
- {
- if (qual_type->isObjCObjectPointerType())
- return lldb::eLanguageTypeObjC;
-
- clang::QualType pointee_type (qual_type->getPointeeType());
- if (pointee_type->getCXXRecordDeclForPointerType() != NULL)
- return lldb::eLanguageTypeC_plus_plus;
- if (pointee_type->isObjCObjectOrInterfaceType())
- return lldb::eLanguageTypeObjC;
- if (pointee_type->isObjCClassType())
- return lldb::eLanguageTypeObjC;
- }
- else
- {
- if (ClangASTContext::IsObjCClassType (opaque_qual_type))
- return lldb::eLanguageTypeObjC;
- if (ClangASTContext::IsCXXClassType (opaque_qual_type))
- return lldb::eLanguageTypeC_plus_plus;
- }
-
- return lldb::eLanguageTypeC;
+ return ClangASTType::GetMinimumLanguage (GetClangType());
}
void
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=136536&r1=136535&r2=136536&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Jul 29 18:21:00 2011
@@ -156,6 +156,92 @@
}
+lldb::LanguageType
+ClangASTType::GetMinimumLanguage ()
+{
+ return ClangASTType::GetMinimumLanguage (m_type);
+}
+
+lldb::LanguageType
+ClangASTType::GetMinimumLanguage (lldb::clang_type_t clang_type)
+{
+ if (clang_type == NULL)
+ return lldb::eLanguageTypeC;
+
+ // If the type is a reference, then resolve it to what it refers to first:
+ clang::QualType qual_type (clang::QualType::getFromOpaquePtr(clang_type).getNonReferenceType());
+ if (qual_type->isAnyPointerType())
+ {
+ if (qual_type->isObjCObjectPointerType())
+ return lldb::eLanguageTypeObjC;
+
+ clang::QualType pointee_type (qual_type->getPointeeType());
+ if (pointee_type->getCXXRecordDeclForPointerType() != NULL)
+ return lldb::eLanguageTypeC_plus_plus;
+ if (pointee_type->isObjCObjectOrInterfaceType())
+ return lldb::eLanguageTypeObjC;
+ if (pointee_type->isObjCClassType())
+ return lldb::eLanguageTypeObjC;
+ }
+ else
+ {
+ if (qual_type->isObjCObjectOrInterfaceType())
+ return lldb::eLanguageTypeObjC;
+ if (qual_type->getAsCXXRecordDecl())
+ return lldb::eLanguageTypeC_plus_plus;
+ switch (qual_type->getTypeClass())
+ {
+ default:
+ break;
+ case clang::Type::Builtin:
+ switch (cast<clang::BuiltinType>(qual_type)->getKind())
+ {
+ default:
+ case clang::BuiltinType::Void:
+ case clang::BuiltinType::Bool:
+ case clang::BuiltinType::Char_U:
+ case clang::BuiltinType::UChar:
+ case clang::BuiltinType::WChar_U:
+ case clang::BuiltinType::Char16:
+ case clang::BuiltinType::Char32:
+ case clang::BuiltinType::UShort:
+ case clang::BuiltinType::UInt:
+ case clang::BuiltinType::ULong:
+ case clang::BuiltinType::ULongLong:
+ case clang::BuiltinType::UInt128:
+ case clang::BuiltinType::Char_S:
+ case clang::BuiltinType::SChar:
+ case clang::BuiltinType::WChar_S:
+ case clang::BuiltinType::Short:
+ case clang::BuiltinType::Int:
+ case clang::BuiltinType::Long:
+ case clang::BuiltinType::LongLong:
+ case clang::BuiltinType::Int128:
+ case clang::BuiltinType::Float:
+ case clang::BuiltinType::Double:
+ case clang::BuiltinType::LongDouble:
+ break;
+
+ case clang::BuiltinType::NullPtr:
+ return eLanguageTypeC_plus_plus;
+
+ case clang::BuiltinType::ObjCId:
+ case clang::BuiltinType::ObjCClass:
+ case clang::BuiltinType::ObjCSel:
+ return eLanguageTypeObjC;
+
+ case clang::BuiltinType::Dependent:
+ case clang::BuiltinType::Overload:
+ case clang::BuiltinType::BoundMember:
+ case clang::BuiltinType::UnknownAny:
+ break;
+ }
+ break;
+ }
+ }
+ return lldb::eLanguageTypeC;
+}
+
lldb::Encoding
ClangASTType::GetEncoding (clang_type_t clang_type, uint32_t &count)
{
More information about the lldb-commits
mailing list