Commit Graph

10 Commits

Author SHA1 Message Date
Richard Smith 091405d7e3 Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.

llvm-svn: 217293
2014-09-06 00:24:58 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
John McCall d239387098 When we're flagging a protected scope to prevent jumps into the
shadow of a block expression with non-trivial destructed cleanups,
we should flag that in the enclosing function, not in the block
that we're about to pop.

llvm-svn: 154646
2012-04-13 01:08:17 +00:00
Eli Friedman 25b0742603 Make sure a variable with a C++ direct initializer triggers jump scope checking. Fixes PR10620 / <rdar://problem/9958362> .
llvm-svn: 150204
2012-02-09 20:13:14 +00:00
Douglas Gregor d7d7e0d3df Minor fix in the injection of labels, since we want to look at the redeclaration context of each declaration in the identifier chain. Should fix Linux self-host
llvm-svn: 128210
2011-03-24 14:35:16 +00:00
Douglas Gregor 33f352ca62 Fix the insertion of label declarations into the identifier chain in
the case where we only have a single identifier with that name in the
chain. Fixes PR9463 for real this time.

llvm-svn: 128208
2011-03-24 10:35:39 +00:00
Douglas Gregor 336a15e041 Unbreak test
llvm-svn: 128168
2011-03-23 21:19:43 +00:00
Douglas Gregor a0ff0c34a7 Make sure that we always pop a function's scope *before* we call
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.

Fixes PR9495.

llvm-svn: 127738
2011-03-16 17:05:57 +00:00
Douglas Gregor 46c04e74fb When we're inserting a synthesized label declaration for a
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.

Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.

Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.

llvm-svn: 127737
2011-03-16 16:39:03 +00:00
Douglas Gregor 88764cf822 When synthesizing a label declaration based on a goto statement that
cannot yet be resolved, be sure to push the new label declaration into
the right place within the identifier chain. Otherwise, name lookup in
C++ gets confused when searching for names that are lexically closer
than the label. Fixes PR9463.

llvm-svn: 127623
2011-03-14 21:19:51 +00:00