[cfe-commits] r45976 - in /cfe/trunk: AST/Type.cpp test/Sema/complex-int.c

Neil Booth neil at daikokuya.co.uk
Mon Jan 14 14:46:48 PST 2008


Steve Naroff wrote:-

> Author: snaroff
> Date: Mon Jan 14 15:38:57 2008
> New Revision: 45976
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=45976&view=rev
> Log:
> Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
> 
> Bug submitted by Eli.
> 
> 
> Added:
>     cfe/trunk/test/Sema/complex-int.c
> Modified:
>     cfe/trunk/AST/Type.cpp
> 
> Modified: cfe/trunk/AST/Type.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=45976&r1=45975&r2=45976&view=diff
> 
> ==============================================================================
> --- cfe/trunk/AST/Type.cpp (original)
> +++ cfe/trunk/AST/Type.cpp Mon Jan 14 15:38:57 2008
> @@ -310,6 +310,9 @@
>    if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
>      if (TT->getDecl()->getKind() == Decl::Enum)
>        return true;
> +  // Check for GCC complex integer extension.
> +  if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
> +    return CT->getElementType()->isIntegerType();
>    if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
>      return VT->getElementType()->isIntegerType();
>    return false;

I think this is a *really* bad idea opening up endless bugs.

It seems we accept complex ints and vectors of ints wherever
we accept an int, such as a switch condition, etc.

Neil.



More information about the cfe-commits mailing list