diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-04-29 22:01:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-04-29 22:01:25 +0000 |
commit | d237d2e6b85a74f31c986dc585fa6c39733b74a2 (patch) | |
tree | 3fea7e7e53d2cc9d3d0e348ad40060508883198b /lib/Sema/SemaChecking.cpp | |
parent | 548107ee5241037b4533d86afbe0cf38ddf6b5d9 (diff) |
c language: diagnose use of "[*]" on any array dimension
in the parameter of a function definition. Currently,
it crashes in irgen if it is on other than the 1st dimension.
// rdar://13705391
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 8adfbd598f..c19fe27c7f 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -5703,12 +5703,14 @@ bool Sema::CheckParmsForFunctionDef(ParmVarDecl **P, ParmVarDecl **PEnd, // notation in their sequences of declarator specifiers to specify // variable length array types. QualType PType = Param->getOriginalType(); - if (const ArrayType *AT = Context.getAsArrayType(PType)) { + while (const ArrayType *AT = Context.getAsArrayType(PType)) { if (AT->getSizeModifier() == ArrayType::Star) { // FIXME: This diagnostic should point the '[*]' if source-location // information is added for it. Diag(Param->getLocation(), diag::err_array_star_in_function_definition); + break; } + PType= AT->getElementType(); } } |