[cfe-commits] r119583 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td include/clang/Driver/Options.td include/clang/Sema/Sema.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/warn-argument-larger-than.cpp

Anders Carlsson andersca at mac.com
Wed Nov 17 19:49:03 PST 2010


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.

- Anders


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


More information about the cfe-commits mailing list