[cfe-commits] r104739 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/SemaCXX/flexible-array-test.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed May 26 13:46:24 PDT 2010
Author: fjahanian
Date: Wed May 26 15:46:24 2010
New Revision: 104739
URL: http://llvm.org/viewvc/llvm-project?rev=104739&view=rev
Log:
Improve on flexible array diagnostics (PR7029).
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/flexible-array-test.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=104739&r1=104738&r2=104739&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 26 15:46:24 2010
@@ -1829,7 +1829,7 @@
def err_flexible_array_empty_struct : Error<
"flexible array %0 not allowed in otherwise empty struct">;
def err_flexible_array_has_nonpod_type : Error<
- "flexible array %0 must have a non-dependent, non-POD type">;
+ "flexible array member %0 of non-POD element type %1">;
def ext_flexible_array_in_struct : Extension<
"%0 may not be nested in a struct due to flexible array member">;
def ext_flexible_array_in_array : Extension<
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=104739&r1=104738&r2=104739&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed May 26 15:46:24 2010
@@ -6139,7 +6139,7 @@
if (!FD->getType()->isDependentType() &&
!Context.getBaseElementType(FD->getType())->isPODType()) {
Diag(FD->getLocation(), diag::err_flexible_array_has_nonpod_type)
- << FD->getDeclName();
+ << FD->getDeclName() << FD->getType();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
Modified: cfe/trunk/test/SemaCXX/flexible-array-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/flexible-array-test.cpp?rev=104739&r1=104738&r2=104739&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/flexible-array-test.cpp (original)
+++ cfe/trunk/test/SemaCXX/flexible-array-test.cpp Wed May 26 15:46:24 2010
@@ -41,5 +41,5 @@
struct X {
int blah;
- S strings[]; // expected-error {{flexible array 'strings' must have a non-dependent, non-POD type}}
+ S strings[]; // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}}
};
More information about the cfe-commits
mailing list