[Lldb-commits] [lldb] r146537 - in /lldb/trunk/source/Expression: ASTResultSynthesizer.cpp ClangASTSource.cpp ClangUserExpression.cpp IRForTarget.cpp
Sean Callanan
scallanan at apple.com
Tue Dec 13 17:13:04 PST 2011
Author: spyffe
Date: Tue Dec 13 19:13:04 2011
New Revision: 146537
URL: http://llvm.org/viewvc/llvm-project?rev=146537&view=rev
Log:
This commit is the result of a general audit of
the expression parser to locate instances where
dyn_cast<>() and isa<>() are used on types, and
replace them with getAs<>() as appropriate.
The difference is that dyn_cast<>() and isa<>()
are essentially LLVM/Clang's equivalent of RTTI
-- that is, they try to downcast the object and
return NULL if they cannot -- but getAs<>() can
traverse typedefs to perform a semantic cast.
Modified:
lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=146537&r1=146536&r2=146537&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Tue Dec 13 19:13:04 2011
@@ -333,7 +333,7 @@
QualType ptr_qual_type;
- if (isa<ObjCObjectType>(expr_qual_type))
+ if (expr_qual_type->getAs<ObjCObjectType>() != NULL)
ptr_qual_type = Ctx.getObjCObjectPointerType(expr_qual_type);
else
ptr_qual_type = Ctx.getPointerType(expr_qual_type);
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=146537&r1=146536&r2=146537&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Dec 13 19:13:04 2011
@@ -220,7 +220,7 @@
if (!opaque_type)
continue;
- const TagType *tag_type = dyn_cast<TagType>(QualType::getFromOpaquePtr(opaque_type).getTypePtr());
+ const TagType *tag_type = QualType::getFromOpaquePtr(opaque_type)->getAs<TagType>();
if (!tag_type)
continue;
@@ -258,7 +258,7 @@
if (!opaque_type)
continue;
- const TagType *tag_type = dyn_cast<TagType>(QualType::getFromOpaquePtr(opaque_type).getTypePtr());
+ const TagType *tag_type = QualType::getFromOpaquePtr(opaque_type)->getAs<TagType>();
if (!tag_type)
continue;
@@ -677,7 +677,7 @@
QualType backing_qual_type = QualType::getFromOpaquePtr(backing_type);
- const ObjCInterfaceType *backing_interface_type = dyn_cast<ObjCInterfaceType>(backing_qual_type.getTypePtr());
+ const ObjCInterfaceType *backing_interface_type = backing_qual_type.getTypePtr()->getAs<ObjCInterfaceType>();
if (!backing_interface_type)
continue;
@@ -1067,7 +1067,7 @@
// this, we raid the function's FunctionProtoType for types.
QualType qual_type (QualType::getFromOpaquePtr(type));
- const FunctionProtoType *func_proto_type = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
+ const FunctionProtoType *func_proto_type = qual_type.getTypePtr()->getAs<FunctionProtoType>();
if (func_proto_type)
{
@@ -1128,7 +1128,7 @@
{
QualType qual_type = QualType::getFromOpaquePtr(type);
- if (const TagType *tag_type = dyn_cast<clang::TagType>(qual_type))
+ if (const TagType *tag_type = qual_type->getAs<TagType>())
{
TagDecl *tag_decl = tag_type->getDecl();
@@ -1136,7 +1136,7 @@
return tag_decl;
}
- else if (const ObjCObjectType *objc_object_type = dyn_cast<clang::ObjCObjectType>(qual_type))
+ else if (const ObjCObjectType *objc_object_type = qual_type->getAs<ObjCObjectType>())
{
ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface();
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=146537&r1=146536&r2=146537&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Tue Dec 13 19:13:04 2011
@@ -160,7 +160,7 @@
do {
clang::QualType this_type = method_decl->getThisType(decl_context->getParentASTContext());
- const clang::PointerType *this_pointer_type = llvm::dyn_cast<clang::PointerType>(this_type.getTypePtr());
+ const clang::PointerType *this_pointer_type = this_type->getAs<clang::PointerType>();
if (!this_pointer_type)
break;
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=146537&r1=146536&r2=146537&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Dec 13 19:13:04 2011
@@ -632,8 +632,8 @@
clang::QualType pointer_qual_type = result_var->getType();
const clang::Type *pointer_type = pointer_qual_type.getTypePtr();
- const clang::PointerType *pointer_pointertype = dyn_cast<clang::PointerType>(pointer_type);
- const clang::ObjCObjectPointerType *pointer_objcobjpointertype = dyn_cast<clang::ObjCObjectPointerType>(pointer_type);
+ const clang::PointerType *pointer_pointertype = pointer_type->getAs<clang::PointerType>();
+ const clang::ObjCObjectPointerType *pointer_objcobjpointertype = pointer_type->getAs<clang::ObjCObjectPointerType>();
if (pointer_pointertype)
{
More information about the lldb-commits
mailing list