aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-01-13 05:48:52 +0000
committerAnders Carlsson <andersca@mac.com>2009-01-13 05:48:52 +0000
commit906fed0fb54a338961aba3aa54802b7d68de94c7 (patch)
tree0ce6bb608a4a5693b22ecd9d3147f0ee7721ade9 /lib/Sema/SemaExprObjC.cpp
parent518fda1d121dcba3ad7276f5e9a94f733f6e5ecd (diff)
Warn when someone tries to pass a variable with a non-POD type to a varargs function/method/block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 415bc94759..a73f386dab 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -156,8 +156,15 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
// Promote additional arguments to variadic methods.
if (Method->isVariadic()) {
- for (unsigned i = NumNamedArgs; i < NumArgs; ++i)
+ for (unsigned i = NumNamedArgs; i < NumArgs; ++i) {
+ if (!Args[i]->getType()->isPODType()) {
+ Diag(Args[i]->getLocStart(),
+ diag::warn_cannot_pass_non_pod_arg_to_vararg) <<
+ Args[i]->getType() << 2; // Method
+ }
+
DefaultArgumentPromotion(Args[i]);
+ }
} else {
// Check for extra arguments to non-variadic methods.
if (NumArgs != NumNamedArgs) {