[cfe-commits] r43074 - in /cfe/trunk: CodeGen/CGExprScalar.cpp CodeGen/CodeGenFunction.h CodeGen/CodeGenModule.cpp Driver/SerializationTest.cpp include/clang/Basic/IdentifierTable.h win32/clangDriver/clangDriver.vcproj

Ted Kremenek kremenek at apple.com
Wed Oct 17 11:02:58 PDT 2007


Thanks Hartmut.  It's interesting that visual c++ has problems  
compiling it.  Just so that is easier to spot patches like this, in  
the future could you separate (when possible) patches into smaller  
patches?  For example, the patch to the serialization code has nothing  
to do with your modifications to the CodeGen code, so making two  
separate patches here would have made it easier to see what changed.   
Basically I see two orthogonal concepts here; making patches include  
only related changes makes them easier to read.

Another point I should mention is that while your patch is correct, it  
goes against the design I was going after (which illustrates that my  
design is not portable).  Template specialization of inner classes  
without having to specialize the outer class is a useful feature when  
you don't want to redefine (i.e. specialize) the entire outer class.   
Since I only had one example in my code of doing specialization of an  
inner class, this design point didn't show up in my code.  Clearly  
visual c++ doesn't support this, so I will have to find another way.

Thanks so much for spotting this!

Ted

On Oct 17, 2007, at 8:00 AM, Hartmut Kaiser wrote:

> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/Driver/SerializationTest.cpp (original)
> +++ cfe/trunk/Driver/SerializationTest.cpp Wed Oct 17 10:00:17 2007
> @@ -196,29 +196,32 @@
>
>
> template<>
> -struct IntrospectionTrait<clang::IdentifierInfo>::Flags {
> -  enum { isPod = false,  // Cannot copy via memcpy.  Must use copy- 
> ctor.
> -         hasUniqueInstances = true, // Two pointers with different
> -                                    // addreses point to objects
> -                                    // that are not equal to each  
> other.
> -         hasUniqueReferences = true // Two (non-temporary) pointers
> -                                    // will point to distinct  
> instances.
> +struct IntrospectionTrait<clang::IdentifierInfo> {
> +
> +  struct Flags {
> +    enum { isPod = false,  // Cannot copy via memcpy.  Must use  
> copy-ctor.
> +           hasUniqueInstances = true, // Two pointers with different
> +                                      // addreses point to objects
> +                                      // that are not equal to each  
> other.
> +           hasUniqueReferences = true // Two (non-temporary) pointers
> +                                      // will point to distinct  
> instances.
> +    };
> +  };
> +
> +  template<typename Introspector>
> +  struct Ops {
> +    static void Introspect(clang::IdentifierInfo& X, Introspector&  
> I) {
> +  //    I(X.getTokenID());
> +      I(X.getBuiltinID(),9); // FIXME: do 9 bit specialization.
> +  //    I(X.getObjCKeywordID());
> +      I(X.hasMacroDefinition());
> +      I(X.isExtensionToken());
> +      I(X.isPoisoned());
> +      I(X.isOtherTargetMacro());
> +      I(X.isCPlusPlusOperatorKeyword());
> +      I(X.isNonPortableBuiltin());
> +    }
>   };
> -};
> -
> -template<> template<typename Introspector>
> -struct IntrospectionTrait<clang::IdentifierInfo>::Ops<Introspector> {
> -  static void Introspect(clang::IdentifierInfo& X, Introspector& I) {
> -//    I(X.getTokenID());
> -    I(X.getBuiltinID(),9); // FIXME: do 9 bit specialization.
> -//    I(X.getObjCKeywordID());
> -    I(X.hasMacroDefinition());
> -    I(X.isExtensionToken());
> -    I(X.isPoisoned());
> -    I(X.isOtherTargetMacro());
> -    I(X.isCPlusPlusOperatorKeyword());
> -    I(X.isNonPortableBuiltin());
> -  }
> };
>
> template<> template<>
>
> Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=43074&r1=43073&r2=43074&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
> +++ cfe/trunk/include/clang/Basic/IdentifierTable.h Wed Oct 17  
> 10:00:17 2007
> @@ -23,7 +23,7 @@
>
>
> namespace llvm {
> -  template<typename T> class IntrospectionTrait;
> +  template <typename T> struct IntrospectionTrait;
>   template <typename T> struct DenseMapInfo;
> }
>
> @@ -140,7 +140,11 @@
>   void setFETokenInfo(void *T) { FETokenInfo = T; }
>
>   // For serialization and profiling.
> +#if defined(_MSC_VER) && _MSC_VER <= 1400   // workaround for VC++  
> upto V8.0
> +  template<typename T> friend class /*llvm::*/IntrospectionTrait;
> +#else
>   template<typename T> friend class llvm::IntrospectionTrait;
> +#endif
> };
>
> /// IdentifierTable - This table implements an efficient mapping  
> from strings to
> @@ -183,7 +187,11 @@
>   void PrintStats() const;
>
>   // For serialization and profiling.
> +#if defined(_MSC_VER) && _MSC_VER <= 1400   // workaround for VC++  
> upto V8.0
> +  template<typename T> friend class /*llvm::*/IntrospectionTrait;
> +#else
>   template<typename T> friend class llvm::IntrospectionTrait;
> +#endif
> private:
>   void AddKeywords(const LangOptions &LangOpts);
> };

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20071017/e73faa3d/attachment.html>


More information about the cfe-commits mailing list