On Dec 19, 2009, at 12:11 AM, Eli Friedman wrote:

> Author: efriedma
> Date: Sat Dec 19 02:11:05 2009
> New Revision: 91767
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=91767&view=rev
> Log:
> Initialization improvements: addition of string initialization and a few
> small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
> change a bunch of diagnostics which are different with the new initialization
> code.

Cool, thanks! Comments below...

> @@ -2492,7 +2500,8 @@
>                                            const InitializationKind &Kind,
>                                            Expr *Initializer,
>                                        InitializationSequence &Sequence) {
> -  // FIXME: Implement!
> +  Sequence.setSequenceKind(InitializationSequence::StringInit);
> +  Sequence.AddStringInitStep(Entity.getType().getType());
> }

We'll need to perform more of the checking from CheckStringInit here, to 
determine whether it is valid to initialize the entity with the given string 
literal. That will become important when overload resolution switches over to 
using InitializationSequences, because we determine the validity of the 
initialization in the "Try*" function and then actually perform the 
initialization in "Perform". 

> /// \brief Attempt initialization by constructor (C++ [dcl.init]), which
> @@ -2711,10 +2720,17 @@
>       }
>     }    
>   }
> -  
> +
> +  SourceLocation DeclLoc = Initializer->getLocStart();
> +
>   if (const RecordType *SourceRecordType = SourceType->getAs<RecordType>()) {
>     // The type we're converting from is a class type, enumerate its 
> conversion
>     // functions.
> +
> +    // Try to force the type to be complete before enumerating the conversion
> +    // functions; it's okay if this fails, though.
> +    S.RequireCompleteType(DeclLoc, SourceType, 0);

This would be better as

        if (!S.RequireCompleteType(DeclLoc, SourceType, 0)) {
                // enumerate conversion functions
        }

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to