[cfe-commits] r132017 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Sema/ include/clang/Serialization/ lib/AST/ lib/CodeGen/ lib/Parse/ lib/Sema/ lib/Serialization/ test/SemaCXX/ tools/libclang/

Enea Zaffanella zaffanella at cs.unipr.it
Mon May 30 02:11:47 PDT 2011


Il 25/05/2011 00:41, Sean Hunt ha scritto:
> Author: coppro
> Date: Tue May 24 17:41:36 2011
> New Revision: 132017
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=132017&view=rev
> Log:
> Implement a new type node, UnaryTransformType, designed to represent a
> type that turns one type into another. This is used as the basis to
> implement __underlying_type properly - with TypeSourceInfo and proper
> behavior in the face of templates.

[...]

> Modified: cfe/trunk/include/clang/AST/TypeLoc.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=132017&r1=132016&r2=132017&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/TypeLoc.h (original)
> +++ cfe/trunk/include/clang/AST/TypeLoc.h Tue May 24 17:41:36 2011
> @@ -1410,6 +1410,53 @@
>                                                           DecltypeType> {
>  };
>  
> +struct UnaryTransformTypeLocInfo {
> +  // FIXME: While there's only one unary transform right now, future ones may
> +  // need different representations
> +  SourceLocation KWLoc, LParenLoc, RParenLoc;
> +  TypeSourceInfo *UnderlyingTInfo;
> +};

Unless I am missing something obvious ...
there seems to be a naming mismatch here.

UTT type nodes have two types inside, the "base" (i.e., enum) type and
the "transformed" (i.e., underlying) type.
Here we store syntactic info, i.e., the base type rather than the
underlying one. The implementation indeed stores the enum type, but the
field name suggests the other way round.

The name mismatch propagates to accessor methods:

> +class UnaryTransformTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
[...]
> +  TypeSourceInfo* getUnderlyingTInfo() const {
> +    return getLocalData()->UnderlyingTInfo;
> +  }
> +  void setUnderlyingTInfo(TypeSourceInfo *TInfo) {
> +    getLocalData()->UnderlyingTInfo = TInfo;
> +  }

Cheers,
Enea.



More information about the cfe-commits mailing list