aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-18 00:20:36 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-18 00:20:36 +0000
commit1380a147d4578b619c215b23aa79ce17036d3c46 (patch)
treeef5effa3278d65dad0135ef9fbf50206ab140b39 /lib/Sema/SemaDecl.cpp
parentf64d80306144f978148ba92f36f7cea7b671dd34 (diff)
-Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message -Add some comments Suggestions by Chris. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index dc017d2ba5..d36bd178e8 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4869,14 +4869,16 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param,
ParmVarDecl * const *ParamEnd,
QualType ReturnTy,
NamedDecl *D) {
- if (LangOpts.ArgumentLargerThan == 0) // No check.
+ if (LangOpts.NumLargeByValueCopy == 0) // No check.
return;
+ // Warn if the return value is pass-by-value and larger than the specified
+ // threshold.
if (ReturnTy->isPODType() &&
Diags.getDiagnosticLevel(diag::warn_return_value_size) !=
Diagnostic::Ignored) {
unsigned Size = Context.getTypeSizeInChars(ReturnTy).getQuantity();
- if (Size > LangOpts.ArgumentLargerThan)
+ if (Size > LangOpts.NumLargeByValueCopy)
Diag(D->getLocation(), diag::warn_return_value_size)
<< D->getDeclName() << Size;
}
@@ -4884,12 +4886,14 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param,
if (Diags.getDiagnosticLevel(diag::warn_parameter_size)==Diagnostic::Ignored)
return;
+ // Warn if any parameter is pass-by-value and larger than the specified
+ // threshold.
for (; Param != ParamEnd; ++Param) {
QualType T = (*Param)->getType();
if (!T->isPODType())
continue;
unsigned Size = Context.getTypeSizeInChars(T).getQuantity();
- if (Size > LangOpts.ArgumentLargerThan)
+ if (Size > LangOpts.NumLargeByValueCopy)
Diag((*Param)->getLocation(), diag::warn_parameter_size)
<< (*Param)->getDeclName() << Size;
}