summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorSam Weinig <sam.weinig@gmail.com>2010-02-01 05:02:49 +0000
committerSam Weinig <sam.weinig@gmail.com>2010-02-01 05:02:49 +0000
commitdeb55d512333c4cde3589e9a674924281d71ee3d (patch)
treee01fda6d99ed67918cd759caaedb21f42cd92996 /clang/lib/Sema/SemaChecking.cpp
parent760af170ffa2b384c89dc82da23dc01a2d8d9991 (diff)
downloadbcm5719-llvm-deb55d512333c4cde3589e9a674924281d71ee3d.tar.gz
bcm5719-llvm-deb55d512333c4cde3589e9a674924281d71ee3d.zip
Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
llvm-svn: 94972
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 1e7641690d9..4e2e9c7376b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2616,6 +2616,20 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) {
!Param->isImplicit() &&
!getLangOptions().CPlusPlus)
Diag(Param->getLocation(), diag::err_parameter_name_omitted);
+
+ // C99 6.7.5.3p12:
+ // If the function declarator is not part of a definition of that
+ // function, parameters may have incomplete type and may use the [*]
+ // notation in their sequences of declarator specifiers to specify
+ // variable length array types.
+ QualType PType = Param->getOriginalType();
+ if (const ArrayType *AT = Context.getAsArrayType(PType)) {
+ if (AT->getSizeModifier() == ArrayType::Star) {
+ // FIXME: This diagnosic should point the the '[*]' if source-location
+ // information is added for it.
+ Diag(Param->getLocation(), diag::err_array_star_in_function_definition);
+ }
+ }
}
return HasInvalidParm;
OpenPOWER on IntegriCloud