On Nov 17, 2010, at 7:49 PM, Anders Carlsson wrote: > > Nov 17, 2010 kl. 3:11 PM skrev Argyrios Kyrtzidis: > >> Author: akirtzidis >> Date: Wed Nov 17 17:11:54 2010 >> New Revision: 119583 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=119583&view=rev >> Log: >> Introduce option -Wargument-larger-than[=N] which warns about function >> definitions if they take by-value >> or return by-value any POD that is larger than some threshold (default is 64 >> bytes). > > Very cool! > > However, I don't think "isPOD" is the right type here. It won't warn for: > > struct A { > private: > int a[100]; > }; > > for example. > > I think what you want to check for (on Itanium at least) is "record type with > a trivial copy constructor or destructor." > If a record type has a non-trivial copy constructor or destructor it will > always be passed by pointer.
I see your point but the standard doesn't make any guarantees about the layout of non-POD types so I'm not sure doing such a Sema check is the "right" thing. Maybe check on the codegen side ? -Argiris > > - Anders > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
