forked from OSchip/llvm-project
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:
parent
0cbd8723f3
commit
828429fea9
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue