febb5b884b1bb946b83800cb77cbea0119570d84 |
|
18-Feb-2011 |
Chris Lattner <sabre@nondot.org> |
fix rdar://9024687, a crash on invalid that we used to silently ignore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
95c225de9fa3d79f70ef5008c0279580a7d9dcad |
|
28-Oct-2010 |
John McCall <rjmccall@apple.com> |
Implement an indirect-goto optimization for goto *&&lbl and respect this in the scope checker. With that done, turn an indirect goto into a protected scope into a hard error; otherwise IR generation has to start worrying about declarations not dominating their scopes, as exemplified in PR8473. If this really affects anyone, I can probably adjust this to only hard-error on possible indirect gotos into VLA scopes rather than arbitrary scopes. But we'll see how people cope with the aggressive change on the marginal feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
97ba481f3f45e5b63b4a354bfb471ce146b7de57 |
|
03-Aug-2010 |
John McCall <rjmccall@apple.com> |
Labels (and case statement) don't create independent scope parents for the purposes of the jump checker. Also extend Ted's iteration fix to labels. Fixes PR7789. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
ebc2fb2ce1f5e775bc8d58b421b2aabbf4f40f57 |
|
12-May-2010 |
John McCall <rjmccall@apple.com> |
Correct spelling of expected error message. Apparently I forgot to re-run the test suite after modifying this diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
ddb0b4d5391d3e6bc9dcf93dc42310b20c96b6fc |
|
12-May-2010 |
John McCall <rjmccall@apple.com> |
When checking scopes for indirect goto, be more permissive (but still safe) about the permitted scopes. Specifically: 1) Permit labels and gotos to appear after a prologue of variable initializations. 2) Permit indirect gotos to jump out of scopes that don't require cleanup. 3) Diagnose possible attempts to indirect-jump out of scopes that do require cleanup. This requires a substantial reinvention of the algorithm for checking indirect goto. The current algorithm is Omega(M*N), with M = the number of unique scopes being jumped from and N = the number of unique scopes being jumped to, with an additional factor that is probably (worst-case) linear in the depth of scopes. Thus the entire thing is likely cubic given some truly bizarre ill-formed code; on well-formed code the additional factor collapses to an amortized constant (when amortized over the entire function) and so the algorithm is quadratic. Even this requires every label to appear in its own scope, which would be very unusual for indirect-goto code (and extremely unlikely for well-formed code); it is far more likely that all labels will be in the same scope and so the algorithm becomes linear. For such a marginal feature, I am fairly happy with this result. (this is using JumpDiagnostic's definition of scope, where successive variables in a block appear in their own scope) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
02db31c62ae6c68b5cbbecd09acbbc09bc03d110 |
|
05-Mar-2010 |
Chris Lattner <sabre@nondot.org> |
Emit warning on indirect goto that potentially violates scope instead of error, PR6517 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
fc3a0700bd63716b89eaabfd6a3da34019ffdb2e |
|
05-Mar-2010 |
Chris Lattner <sabre@nondot.org> |
address PR6502 by downgrading the scope checker's address of label error to a warning controllable with a -W flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
46171917dc87caf0c7a741a7301f36db2e20b132 |
|
23-Jan-2010 |
Mike Stump <mrs@apple.com> |
Insulate these from changes to the default for -Wunreachable-code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
a3899eb5e30426b00b80232a15ae557dd4caa5b8 |
|
20-Jan-2010 |
Mike Stump <mrs@apple.com> |
Implement goto inside of blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 |
|
15-Dec-2009 |
Daniel Dunbar <daniel@zuster.org> |
Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
17a783055a41a44fda76b1747ebe6fd8ac2ba00a |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
run the jump checker on blocks, even though they don't have gotos, they do allow switches. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
38c5ebd7b1b65304c7b5c7b9bf3f9162df22e77d |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
add a new Sema::CurFunctionNeedsScopeChecking bool that is used to avoid calling into the jump checker when a function or method is known to contain no VLAs or @try blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69509 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
deae3a735d92b999bfc3b43f2bbe75a6c5b9a1a1 |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
apparently gotos aren't allowed at all in blocks. Stub out a testcase for when/if they are. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
3037a822388348eb16f462c2c8aee77b2fdc286c |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
more testcases of variably modified types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
b5cf1ea6f410f72290b9c7767a63717a944c7a8f |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
second half of indirect jump checking: make sure that any address taken labels are in function scope git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
04ea2b633a1f8ee662b8a99d2903a11c1b68e1ed |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
First half of jump scope checking for indirect goto. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
c78476b711902757f3600d75b180e8fe299c3f33 |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
add some testcases that we do not correctly handle. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
2b7b2ca64ad8d293d10909a7ac119fa3fc10c95c |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
reimplement DeclStmt handling so that we correctly handle intermixed VLA's and statement expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
5b40e0cebcb883540ec3005c47a960107e65f375 |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
rearrange. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
35562d18ea134f88ec09f12626f403a28adb4306 |
|
19-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
add testcases for some more scary/horrible things that work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
b56593725243becfe2685f39eec47406299801ae |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
unconditionally check for goto correctness. This is because switch statements don't end up in the LabelMap so we don't have a quick way to filter them. We could add state to Sema (a "has vla" and "has jump" bit) to try to filter this out, but that would be sort of gross and I'm not convinced it is the best way. Thoughts welcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
a9768b72bb5ea061c9f10d6aa51b3be3241f3ec2 |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
Improve switch diagnostic to emit the "jump" message on the specific bad case instead of on the switch. Putting it on the switch means you don't know what case is the problem. For example: scope-check.c:54:3: error: illegal switch case into protected scope case 2: ^ scope-check.c:53:9: note: jump bypasses initialization of variable length array int a[x]; ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
366920a45e3e278d35cbc3bc74d9d0676ae87dfe |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
first step to getting switches giving "jump into vla scope" errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
5ce71c99cf00f24f876548d7f0dd0eefac47b168 |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
improve wording of scope violation error messages. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
a5251fcf79ae9707680d656377a6e43dcbff6c25 |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
rewrite the goto scope checking code to be more efficient, simpler, produce better diagnostics, and be more correct in ObjC cases (fixing rdar://6803963). An example is that we now diagnose: int test1(int x) { goto L; int a[x]; int b[x]; L: return sizeof a; } with: scope-check.c:15:3: error: illegal goto into protected scope goto L; ^ scope-check.c:17:7: note: scope created by variable length array int b[x]; ^ scope-check.c:16:7: note: scope created by variable length array int a[x]; ^ instead of just saying "invalid jump". An ObjC example is: void test1() { goto L; @try { L: ; } @finally { } } t.m:6:3: error: illegal goto into protected scope goto L; ^ t.m:7:3: note: scope created by @try block @try { ^ There are a whole ton of fixme's for stuff to do, but I believe that this is a monotonic improvement over what we had. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
fd0c0cf85738a664e32f24f56972b3aca2419338 |
|
18-Apr-2009 |
Chris Lattner <sabre@nondot.org> |
add another testcase git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
1b6823d48da16b64cfb13d818860a21472183ca0 |
|
15-Apr-2009 |
Steve Naroff <snaroff@apple.com> |
Revert previous patch (will commit a fix soon). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
d7d5f0223bd30dfd618762349c6209dd1d5ea3e6 |
|
24-Mar-2009 |
Daniel Dunbar <daniel@zuster.org> |
Rename clang to clang-cc. Tests and drivers updated, still need to shuffle dirs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
709fa15defbc0208b33707b3da3a628df5a9b7b9 |
|
28-Feb-2009 |
Eli Friedman <eli.friedman@gmail.com> |
Check a few more kinds of declarations that make a scope. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|
8f17b66c8d383d458e04cada4c9e2452139b0b39 |
|
28-Feb-2009 |
Eli Friedman <eli.friedman@gmail.com> |
Start of checking for gotos which jump to an illegal destination. As far as I know, this catches all cases of jumping into the scope of a variable with a variably modified type (excluding statement expressions) in C. This is missing some stuff we probably want to check (other kinds of variably modified declarations, statement expressions, indirect gotos/addresses of labels in a scope, ObjC @try/@finally, cleanup attribute), the diagnostics aren't very good, and it's not particularly efficient, but it's a decent start. This patch is a slightly modified version of the patch I attached to PR3259, and it fixes that bug. I was sort of planning on improving it, but I think it's okay as-is, especially since it looks like CodeGen doesn't have any use for this sort of data structure. The only significant change I can think of from the version I attached to PR3259 is that this version skips running the checking code when a function doesn't contain any labels. This patch doesn't cover case statements, which also need similar checking; I'm not sure how we should deal with that. Extending the goto checking to also check case statements wouldn't be too hard; it's just a matter of keeping track of the scope of the closest switch and checking that the scope of every case is the same as the scope of the switch. That said, it would likely be a performance hit to run this check on every function (it's an extra pass over the entire function), so we probably want some other solution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/scope-check.c
|