aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-17 23:11:54 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-17 23:11:54 +0000
commit3532fdd1db8ff6f353f2a5b215cebe3e0e2ff3c2 (patch)
treedb6a848f7bc2bd18e2137862feafdb8612f34eea /lib/Driver/Tools.cpp
parentfdda17179047ff0b5e28cc777dc89ebc42f083cf (diff)
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). Implements rdar://8548050. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index aa1b439916..d9e3760a8d 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1199,6 +1199,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(A->getValue(Args));
}
+ if (Arg *A = Args.getLastArg(options::OPT_Wargument_larger_than_EQ,
+ options::OPT_Wargument_larger_than_def)) {
+ CmdArgs.push_back("-Wargument-larger-than");
+ if (A->getNumValues())
+ CmdArgs.push_back(A->getValue(Args));
+ else
+ CmdArgs.push_back("64"); // default value for -Wargument-larger-than
+ }
+
if (Args.hasArg(options::OPT__relocatable_pch))
CmdArgs.push_back("-relocatable-pch");