[cfe-commits] r64307 - in /cfe/trunk: include/clang/AST/Type.h lib/Sema/Sema.h lib/Sema/SemaTemplate.cpp lib/Sema/SemaType.cpp

Chris Lattner clattner at apple.com
Wed Feb 11 10:10:55 PST 2009


On Feb 11, 2009, at 8:47 AM, Douglas Gregor wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=64307&view=rev
> Log:
> Rename Sema::hasSameType to QualType::isSameAs
> Rename Sema::hasSameUnqualifiedType to  
> QualType::isSameIgnoringQalifiers

Hey Doug, sorry to keep bugging you about this.

> +/// \brief Determine whether this type and Other represent the same  
> type.
> +inline bool QualType::isSameAs(QualType Other) const {
> +  return getTypePtr()->getCanonicalTypeInternal() ==
> +      Other.getTypePtr()->getCanonicalTypeInternal();
> +}

I don't think this is safe.  If "this" is  'const on "int[4]"' and  
Other is "(const int)[4]", this will return false.  You need to use  
the ASTContext version of getCanonicalType to handle this.  I'm sorry  
I didn't notice this before, but it seems like these should move to  
ASTContext.  hop hop hop,

-Chris 
  



More information about the cfe-commits mailing list