Fix isStructureType and isUnionType to ignore typedefs, as stated

in the header. Patch by Cédric Venet.

llvm-svn: 44519
This commit is contained in:
Seo Sanghyeon 2007-12-02 16:57:27 +00:00
parent 0cbd8723f3
commit 828429fea9
2 changed files with 8 additions and 2 deletions

View File

@ -61,13 +61,13 @@ bool Type::isDerivedType() const {
}
bool Type::isStructureType() const {
if (const RecordType *RT = dyn_cast<RecordType>(this))
if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
if (RT->getDecl()->getKind() == Decl::Struct)
return true;
return false;
}
bool Type::isUnionType() const {
if (const RecordType *RT = dyn_cast<RecordType>(this))
if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
if (RT->getDecl()->getKind() == Decl::Union)
return true;
return false;

View File

@ -16,3 +16,9 @@ int f2( float __x ) {
}__u;
return (int)(__u.__u >> 31);
}
typedef union { int i; int *j; } value;
int f3(value v) {
return *v.j;
}