[cfe-commits] r65680 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/scope-check.c
Eli Friedman
eli.friedman at gmail.com
Fri Feb 27 22:22:14 PST 2009
Author: efriedma
Date: Sat Feb 28 00:22:14 2009
New Revision: 65680
URL: http://llvm.org/viewvc/llvm-project?rev=65680&view=rev
Log:
Check a few more kinds of declarations that make a scope.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/scope-check.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=65680&r1=65679&r2=65680&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Feb 28 00:22:14 2009
@@ -2503,6 +2503,9 @@
i != DS->decl_end(); ++i) {
if (VarDecl* D = dyn_cast<VarDecl>(*i)) {
result |= D->getType()->isVariablyModifiedType();
+ result |= !!D->getAttr<CleanupAttr>();
+ } else if (TypedefDecl* D = dyn_cast<TypedefDecl>(*i)) {
+ result |= D->getUnderlyingType()->isVariablyModifiedType();
}
}
}
Modified: cfe/trunk/test/Sema/scope-check.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/scope-check.c?rev=65680&r1=65679&r2=65680&view=diff
==============================================================================
--- cfe/trunk/test/Sema/scope-check.c (original)
+++ cfe/trunk/test/Sema/scope-check.c Sat Feb 28 00:22:14 2009
@@ -6,3 +6,19 @@
L:
return sizeof a;
}
+
+int test2(int x) {
+ goto L; // expected-error{{illegal jump}}
+ typedef int a[x];
+ L:
+ return sizeof(a);
+}
+
+void test3clean(int*);
+
+int test3() {
+ goto L; // expected-error{{illegal jump}}
+ int a __attribute((cleanup(test3clean)));
+ L:
+ return a;
+}
More information about the cfe-commits
mailing list