[cfe-commits] r91767 - in /cfe/trunk: lib/Sema/ test/CXX/class/class.local/ test/CXX/dcl.decl/dcl.meaning/dcl.mptr/ test/CXX/over/over.over/ test/Sema/ test/SemaCXX/ test/SemaObjCXX/ test/SemaTemplate/

Douglas Gregor dgregor at apple.com
Sun Dec 20 13:07:45 PST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091220/068ad604/attachment.html>


More information about the cfe-commits mailing list