[cfe-commits] r151862 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/variadic-incomplete-arg-type.c

Eli Friedman eli.friedman at gmail.com
Thu Mar 1 16:21:55 PST 2012


On Thu, Mar 1, 2012 at 3:42 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Thu Mar  1 17:42:00 2012
> New Revision: 151862
>
> URL: http://llvm.org/viewvc/llvm-project?rev=151862&view=rev
> Log:
> c/objc: problem originally reported as an objective-c bug.
> But it is in the underlying c part of clang. clang crashes
> in IRGen when passing an incomplete type argument to
> variadic function (instead of diagnosing the bug).
> // rdar://10961370
>
> Added:
>    cfe/trunk/test/Sema/variadic-incomplete-arg-type.c
> Modified:
>    cfe/trunk/lib/Sema/SemaExpr.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=151862&r1=151861&r2=151862&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Mar  1 17:42:00 2012
> @@ -587,6 +587,12 @@
>       E = Comma.get();
>     }
>   }
> +  // c++ rules are enfroced elsewhere.

Spelling.

> +  if (!getLangOptions().CPlusPlus &&
> +      !E->getType()->isVoidType() &&

I really don't think we want to allow "void a(int x, ...); void b() {
a(1, (void)0); }".

> +      RequireCompleteType(E->getExprLoc(), E->getType(),
> +                          diag::err_incomplete_type))

diag::err_call_incomplete_argument is a bit more specific.

-Eli




More information about the cfe-commits mailing list