summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-03-07 18:55:10 +0000
committerReid Kleckner <rnk@google.com>2018-03-07 18:55:10 +0000
commitb2da08610327d32474a931502c03f486ccbe36ac (patch)
treea7a30e4341e4b7c94f4df18d60c968b5bc9c5c34 /lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
parent4b8bcf007b050650a6e4f3273f1596fc6b876ea4 (diff)
downloadbcm5719-llvm-b2da08610327d32474a931502c03f486ccbe36ac.tar.gz
bcm5719-llvm-b2da08610327d32474a931502c03f486ccbe36ac.zip
Push a function scope when parsing function bodies without a declaration
Summary: This is PR36536. There are a few ways to reach Sema::ActOnStartOfFunctionDef with a null Decl. Currently, the parser continues on to attempt to parse the statements in the function body without pushing a function scope or declaration context. However, lots of statement parsing logic relies on getCurFunction() returning something reasonable. It turns out that getCurFunction() will never return null today because of an optimization where Sema pre-allocates one FunctionScopeInfo and reuses it when possible. This goes wrong when something inside the function body causes us to push another function scope, such as requiring an implicit definition of a special member function. Reusing the state clears it out, which will lead to bugs. In PR36536, we found that the SwitchStack gets unbalanced, because we push a switch, clear out the stack, and then try to pop a switch that isn't there. As a follow-up, I plan to move the pre-allocated FunctionScopeInfo out of the FunctionScopes stack. This means the FunctionScopes stack will often be empty, and callers of getCurFunction() will need to check for null. Reviewers: thakis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43980 llvm-svn: 326926
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud