[cfe-commits] r150318 - in /cfe/trunk: include/clang/AST/ include/clang/Sema/ lib/AST/ lib/CodeGen/ lib/Parse/ lib/Sema/ lib/Serialization/ test/CXX/temp/temp.decls/temp.variadic/ test/Sema/ test/SemaTemplate/

Douglas Gregor dgregor at apple.com
Mon Feb 13 14:05:47 PST 2012


On Feb 11, 2012, at 3:51 PM, Sebastian Redl <sebastian.redl at getdesigned.at> wrote:

> Author: cornedbee
> Date: Sat Feb 11 17:51:47 2012
> New Revision: 150318
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=150318&view=rev
> Log:
> Represent C++ direct initializers as ParenListExprs before semantic analysis
> instead of having a special-purpose function.
> 
> - ActOnCXXDirectInitializer, which was mostly duplication of
>  AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days
>  ago), is dropped completely.
> - MultiInitializer, which was an ugly hack I added, is dropped again.
> - We now have the infrastructure in place to distinguish between
>  int x = {1};
>  int x({1});
>  int x{1};
> -- VarDecl now has getInitStyle(), which indicates which of the above was used.
> -- CXXConstructExpr now has a flag to indicate that it represents list-
>   initialization, although this is not yet used.
> - InstantiateInitializer was renamed to SubstInitializer and simplified.
> - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which
>  always produces a ParenListExpr. Placed that so far failed to convert that
>  back to a ParenExpr containing comma operators have been fixed. I'm pretty
>  sure I could have made a crashing test case before this.
> 
> The end result is a (I hope) considerably cleaner design of initializers.
> More importantly, the fact that I can now distinguish between the various
> initialization kinds means that I can get the tricky generalized initializer
> test cases Johannes Schaub supplied to work. (This is not yet done.)

I like this a lot. It eliminates some really annoying redundancy and ugliness in the initialization ASTs.

	- Doug



More information about the cfe-commits mailing list