llvm-project/lldb/source/Expression
Greg Clayton 4e1042e1bf Allow expresions to have unique expression prefixes:
expr_options = lldb.SBExpressionOptions()
expr_options.SetPrefix('''
struct Foo {
   int a;
   int b;
   int c;
}
'''
expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options)

This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful.

<rdar://problem/21130675>

llvm-svn: 238365
2015-05-27 22:32:39 +00:00
..
ASTDumper.cpp Huge change to clean up types. 2013-07-11 22:46:58 +00:00
ASTResultSynthesizer.cpp In commit clang r226096, DefinitionRequired has been removed. Do the same in lldb implementation 2015-01-15 11:50:50 +00:00
ASTStructExtractor.cpp In commit clang r226096, DefinitionRequired has been removed. Do the same in lldb implementation 2015-01-15 11:50:50 +00:00
CMakeLists.txt Added CMake support so all the Clang modules code 2014-12-05 01:31:55 +00:00
ClangASTSource.cpp Fix resolution of certain recursive types. 2015-04-08 21:52:45 +00:00
ClangExpressionDeclMap.cpp Don't allow infininte recursion when trying to resolve re-exported symbols. 2015-05-15 21:27:16 +00:00
ClangExpressionParser.cpp Added support for locating and importing functions 2015-05-01 00:47:29 +00:00
ClangExpressionVariable.cpp Add the ability for an SBValue to create a persisted version of itself. 2014-12-08 23:13:56 +00:00
ClangFunction.cpp ClangFunction: Fix destruction order of parser and execution unit 2014-12-10 04:59:18 +00:00
ClangModulesDeclVendor.cpp Updated our use of clang::Preprocessor to reflect 2015-05-01 00:19:44 +00:00
ClangPersistentVariables.cpp I have brought LLDB up-to-date with top of tree 2012-02-04 08:49:35 +00:00
ClangUserExpression.cpp Allow expresions to have unique expression prefixes: 2015-05-27 22:32:39 +00:00
ClangUtilityFunction.cpp Reverse out r219169 related to quote handling. 2014-10-10 01:11:39 +00:00
DWARFExpression.cpp Move lldb-log.cpp to core/Logging.cpp 2015-03-18 18:20:42 +00:00
ExpressionSourceCode.cpp Made macros from modules be injected before our 2015-04-30 21:49:58 +00:00
IRDynamicChecks.cpp Revert "Update for LLVM API change in r221024" 2014-11-12 01:59:53 +00:00
IRExecutionUnit.cpp Fixed a ton of gcc compile warnings 2015-05-13 00:25:54 +00:00
IRForTarget.cpp Updated IRForTarget to change the way we generate 2015-04-14 18:17:35 +00:00
IRInterpreter.cpp remove trailing whitespace + remove some useless comments 2014-07-06 17:54:58 +00:00
IRMemoryMap.cpp Dont' use a random probe & alloc strategy for the IRMemoryMap. 2014-07-09 16:42:27 +00:00
Makefile remove trailing whitespace + remove some useless comments 2014-07-06 17:54:58 +00:00
Materializer.cpp Don't #include ClangPersistentVariables.h from Process.h 2015-03-03 21:05:17 +00:00