| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
can avoid running the code in the target if the
expression's result is known and the expression
has no side effects.
Right now this feature is quite conservative in
its guess about side effects, and it only computes
integer results, but the machinery to make it more
sophisticated is there.
llvm-svn: 121952
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
access to the members of the Objective-C self object.
The approach we take is to generate the method as a
@category on top of the self object, and to pass the
"self" pointer to it. (_cmd is currently NULL.)
Most changes are in ClangExpressionDeclMap, but the
change that adds support to the ABIs to pass _cmd
touches a fair amount of code.
llvm-svn: 121722
|
| |
|
|
|
|
| |
when calling built-ins.
llvm-svn: 121070
|
| |
|
|
|
|
|
|
| |
wrongly as the target of a pointer rather than the
SEL pointer itself. This caused incorrect behavior
when dealing with Objective-C selector variables.
llvm-svn: 121048
|
| |
|
|
|
|
|
| |
(for example, string literals) were being flagged
erroneously as undefined external variables.
llvm-svn: 120972
|
| |
|
|
| |
llvm-svn: 120834
|
| |
|
|
| |
llvm-svn: 120788
|
| |
|
|
|
|
|
| |
pointers are used. Previously, they caused a crash
in the JIT because we didn't resolve them correctly.
llvm-svn: 120728
|
| |
|
|
| |
llvm-svn: 119888
|
| |
|
|
|
|
| |
conventions.
llvm-svn: 119771
|
| |
|
|
|
|
|
| |
externally-defined variables to match up with
the code in ClangASTSource that produces them.
llvm-svn: 119750
|
| |
|
|
|
|
|
| |
They are replaced with calls to the CoreFoundation function
CFStringCreateWithBytes() by a portion of the IRForTarget pass.
llvm-svn: 119582
|
| |
|
|
|
|
|
|
|
|
|
| |
expression logging.
Added some properties to the "objc" test. The expression parser can currently
display properties that are backed by the default functions "expr myStr.string"
will work. But it won't currently work when the property is backed by a
different function such as "expr myStr.date".
llvm-svn: 119103
|
| |
|
|
|
|
|
|
|
| |
every external variable reference in the module,
and returning a clean error (instead of letting
LLVM issue a fatal error) if the variable could
not be resolved.
llvm-svn: 118388
|
| |
|
|
|
|
|
|
|
|
|
| |
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.
llvm-svn: 118319
|
| |
|
|
|
|
|
| |
of store statements were not being marked for
resolution.
llvm-svn: 118316
|
| |
|
|
|
|
|
| |
for a global variable that we had replaced with
a reference to a slot in the input array.
llvm-svn: 118123
|
| |
|
|
|
|
|
|
|
| |
being generated correctly.
Also added a messy way to single-step through expressions
that I will improve soon.
llvm-svn: 117342
|
| |
|
|
|
|
|
| |
as persistent variables. These are special markers
used by LLDB.
llvm-svn: 117078
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changed all of our synthesized "___clang" functions, types and variables
that get used in expressions over to have a prefix of "$_lldb". Now when we
do name lookups we can easily switch off of the first '$' character to know
if we should look through only our internal (when first char is '$') stuff,
or when we should look through program variables, functions and types.
Converted all of the clang expression code over to using "const ConstString&"
values for names instead of "const char *" since there were many places that
were converting the "const char *" names into ConstString names and them
throwing them away. We now avoid making a lot of ConstString conversions and
benefit from the quick comparisons in a few extra spots.
Converted a lot of code from LLVM coding conventions into LLDB coding
conventions.
llvm-svn: 116634
|
| |
|
|
|
|
|
| |
arguments to the expression parser. This means that
structs can be returned from the "expr" command.
llvm-svn: 115698
|
| |
|
|
|
|
|
|
|
|
|
|
| |
to using Clang to get type sizes. This fixes a bug
where the type size for a double[2] was being wrongly
reported as 8 instead of 16 bytes, causing problems
for IRForTarget.
Also improved logging so that the next bug in this
area will be easier to find.
llvm-svn: 115208
|
| |
|
|
|
|
|
| |
intrinsic being used. Thanks to Chris Lattner for
pointing out the proper way to do it.
llvm-svn: 115006
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- the guard variable for the static result
variable was being mistaken for the actual
result value, causing IRForTarget to fail
- LLVM builtins like memcpy were not being
properly resolved; now they are resolved
to the corresponding function in the target
llvm-svn: 114990
|
| |
|
|
|
|
|
|
|
|
| |
- Sema is now exported (and there was much rejoicing.)
- Storage classes are now centrally defined.
Also fixed some bugs that the new LLVM picked up.
llvm-svn: 114622
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for C++ classes. Replaced it with a less hacky approach:
- If an expression is defined in the context of a
method of class A, then that expression is wrapped as
___clang_class::___clang_expr(void*) { ... }
instead of ___clang_expr(void*) { ... }.
- ___clang_class is resolved as the type of the target
of the "this" pointer in the method the expression
is defined in.
- When reporting the type of ___clang_class, a method
with the signature ___clang_expr(void*) is added to
that class, so that Clang doesn't complain about a
method being defined without a corresponding
declaration.
- Whenever the expression gets called, "this" gets
looked up, type-checked, and then passed in as the
first argument.
This required the following changes:
- The ABIs were changed to support passing of the "this"
pointer as part of trivial calls.
- ThreadPlanCallFunction and ClangFunction were changed
to support passing of an optional "this" pointer.
- ClangUserExpression was extended to perform the
wrapping described above.
- ClangASTSource was changed to revert the changes
required by the hack.
- ClangExpressionParser, IRForTarget, and
ClangExpressionDeclMap were changed to handle
different manglings of ___clang_expr flexibly. This
meant no longer searching for a function called
___clang_expr, but rather looking for a function whose
name *contains* ___clang_expr.
- ClangExpressionParser and ClangExpressionDeclMap now
remember whether "this" is required, and know how to
look it up as necessary.
A few inheritance bugs remain, and I'm trying to resolve
these. But it is now possible to use "this" as well as
refer implicitly to member variables, when in the proper
context.
llvm-svn: 114384
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- If you put a semicolon at the end of an expression,
this no longer causes the expression parser to
error out. This was a two-part fix: first,
ClangExpressionDeclMap::Materialize now handles
an empty struct (such as when there is no return
value); second, ASTResultSynthesizer walks backward
from the end of the ASTs until it reaches something
that's not a NullStmt.
- ClangExpressionVariable now properly byte-swaps when
printing itself.
- ClangUtilityFunction now cleans up after itself when
it's done compiling itself.
- Utility functions can now use external functions just
like user expressions.
- If you end your expression with a statement that does
not return a value, the expression now runs correctly
anyway.
Also, added the beginnings of an Objective-C object
validator function, which is neither installed nor used
as yet.
llvm-svn: 113789
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
certain functions from being resolved correctly.
Some functions (particularly varargs functions)
are BitCast before being called, and the problem
was that a CallInst where getCalledValue()
returned a BitCast ConstantExpr was not being
relocated at all.
This problem should now be resolved for the case
of BitCast.
llvm-svn: 113396
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expressions correctly. These produced a result
variable with an initializer but no store
instruction, and the store instruction was as
a result never rewritten to become a store to a
persistent variable.
Now if the result variable has an initializer
but is never used, we generate a (redundant)
store instruction for it, which is then later
rewritten into a (useful) store to the persistent
result variable.
llvm-svn: 113300
|
| |
|
|
|
|
|
|
|
| |
symbols with the same name and no debug information.
Also improved the way functions are called so we
don't automatically define them as variadic functions
in the IR.
llvm-svn: 113290
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
persistent variables were staying around too long.
This caused the following problem:
- A persistent result variable is created for the
result of an expression. The pointer to the
corresponding Decl is stored in the variable.
- The persistent variable is looked up during
struct generation (correctly) using its Decl.
- Another expression defines a new result variable
which happens to have a Decl in the same place
as the original result variable.
- The persistent variable is looked up during
struct generation using its Decl, but the old
result variable appears first in the list and
has the same Decl pointer.
The fix is to destroy parser-specific data when
it is no longer valid.
Also improved some logging as I diagnosed the
bug.
llvm-svn: 112540
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal is to separate the parser's data from the data
belonging to the parser's clients. This allows clients
to use the parser to obtain (for example) a JIT compiled
function or some DWARF code, and then discard the parser
state.
Previously, parser state was held in ClangExpression and
used liberally by ClangFunction, which inherited from
ClangExpression. The main effects of this refactoring
are:
- reducing ClangExpression to an abstract class that
declares methods that any client must expose to the
expression parser,
- moving the code specific to implementing the "expr"
command from ClangExpression and
CommandObjectExpression into ClangUserExpression,
a new class,
- moving the common parser interaction code from
ClangExpression into ClangExpressionParser, a new
class, and
- making ClangFunction rely only on
ClangExpressionParser and not depend on the
internal implementation of ClangExpression.
Side effects include:
- the compiler interaction code has been factored
out of ClangFunction and is now in an AST pass
(ASTStructExtractor),
- the header file for ClangFunction is now fully
documented,
- several bugs that only popped up when Clang was
deallocated (which never happened, since the
lifetime of the compiler was essentially infinite)
are now fixed, and
- the developer-only "call" command has been
disabled.
I have tested the expr command and the Objective-C
step-into code, which use ClangUserExpression and
ClangFunction, respectively, and verified that they
work. Please let me know if you encounter bugs or
poor documentation.
llvm-svn: 112249
|
| |
|
|
|
|
|
|
| |
ClangExpressionVariables for found external variables
as well as for struct members, replacing the Tuple
and StructMember data structures.
llvm-svn: 111859
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expression parser. There shouldn't be four separate
classes encapsulating a variable.
ClangExpressionVariable is now meant to be the
container for all variable information. It has
several optional components that hold data for
different subsystems.
ClangPersistentVariable has been removed; we now
use ClangExpressionVariable instead.
llvm-svn: 111600
|
| |
|
|
|
|
| |
in the IR transformation passes.
llvm-svn: 111388
|
| |
|
|
|
|
|
|
| |
Also cleaned up its API a tiny bit (but not the
extensive amount that is actually needed. That's
still coming.)
llvm-svn: 111049
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expression. It is now possible to do things like this:
(lldb) expr int $i = 5; $i + 1
$0 = (int) 6
(lldb) expr $i + 3
$1 = (int) 8
(lldb) expr $1 + $0
$2 = (int) 14
As a bonus, this allowed us to move printing of
expression results into the ClangPersistentVariable
class. This code needs a bit of refactoring -- in
particular, ClangExpressionDeclMap has eaten one too
many bacteria and needs to undergo mitosis -- but the
infrastructure appears to be holding up nicely.
llvm-svn: 110896
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expression parser. It is now possible to type:
(lldb) expr int $i = 5; $i + 1
(int) 6
(lldb) expr $i + 2
(int) 7
The skeleton for automatic result variables is
also implemented. The changes affect:
- the process, which now contains a
ClangPersistentVariables object that holds
persistent variables associated with it
- the expression parser, which now uses
the persistent variables during variable
lookup
- TaggedASTType, where I loaded some commonly
used tags into a header so that they are
interchangeable between different clients of
the class
llvm-svn: 110777
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
including superclass members. This involved ensuring
that access control was ignored, and ensuring that
the operands of BitCasts were properly scanned for
variables that needed importing.
Also laid the groundwork for declaring objects of
custom types; however, this functionality is disabled
for now because of a potential loop in ASTImporter.
llvm-svn: 110174
|
| |
|
|
|
|
|
|
|
|
| |
of profiling code into expressions.
Modified IRForTarget to emit array and record
member accesses correctly. (Reading and writing
both work.)
llvm-svn: 110088
|
| |
|
|
|
|
|
|
|
|
|
| |
call Objective-C methods from expressions. Also added
some more logging to the function-calling thread plan
so that we can see the registers when a function
finishes.
Also documented things maybe a bit better.
llvm-svn: 109938
|
| |
|
|
| |
llvm-svn: 109887
|
| |
|
|
|
|
|
| |
diagnose a problem where we're not correctly emitting
PIC code.
llvm-svn: 109568
|
| |
|
|
|
|
|
|
|
| |
Right now we mock up the function as a variadic
function when generating the IR for the call; we need
to eventually make the function be the right type if
the type is available.
llvm-svn: 109543
|
| |
|
|
|
|
|
| |
referenced in the IR. We don't yet support updating
the call to that function.
llvm-svn: 109483
|
| |
|
|
|
|
|
|
| |
trying to do replaceUsesOfWith on a constant,
which doesn't work. Turns out we don't need to
do anything for constants.
llvm-svn: 109477
|
| |
|
|
|
|
|
|
|
|
|
|
| |
spurious guard variables on expression statics.
Updated the AST result synthesizer to eliminate the
unneeded result pointer.
Very rudimentary expressions now evaluate correctly
in the target using the new JIT-based mechanism.
llvm-svn: 109317
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
used by the JIT compiled expression, including the
result of the expression.
Also added a new class, ASTType, which encapsulates an
opaque Clang type and its associated AST context.
Refactored ClangExpressionDeclMap to use ASTTypes,
significantly reducing the possibility of mixups of
types from different AST contexts.
llvm-svn: 108965
|
| |
|
|
|
|
|
| |
if the variables in that context allow a particular
JIT compiled expression to run in that context.
llvm-svn: 108485
|
| |
|
|
|
|
|
|
| |
to correctly unfold constant-folded global variables.
Also added code to JIT the expression. Simple
expressions are now JIT compiled successfully.
llvm-svn: 108380
|