Commit Graph

151 Commits

Author SHA1 Message Date
Vassil Vassilev
acef61e88f Fix not only the address but the string too.
git-svn-id: http://root.cern.ch/svn/root/trunk@46681 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 13:49:34 +00:00
Philippe Canal
e60b8ce424 extend testing of typedef to reference
git-svn-id: http://root.cern.ch/svn/root/trunk@46679 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 13:33:38 +00:00
Vassil Vassilev
94994c05dc Publish the head of the transaction list so that the transactions become
iteratable. (We will use it in TCintWithCling)


git-svn-id: http://root.cern.ch/svn/root/trunk@46677 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 13:30:06 +00:00
Vassil Vassilev
da3a51f5f8 Make the transaction class single list.
git-svn-id: http://root.cern.ch/svn/root/trunk@46676 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 13:29:03 +00:00
Philippe Canal
51a176173b Use llvm::isa rathen that QualType::isXYZ as the later reports about the canonical type while we are interested in the direct type. Make sure to recurse if needed after removing the typedefs
git-svn-id: http://root.cern.ch/svn/root/trunk@46675 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 13:24:46 +00:00
Vassil Vassilev
d132d3d5ba evaluate now builds DeclRefExpr if there is DeclStmt.
Don't run the wrapper function when the transaction was rolled back.


git-svn-id: http://root.cern.ch/svn/root/trunk@46674 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 12:23:34 +00:00
Vassil Vassilev
d916876642 RunFunction takes FunctionDecl as an argument. Thus it avoids a lookup and
simplifies the implementation.


git-svn-id: http://root.cern.ch/svn/root/trunk@46673 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 11:56:52 +00:00
Vassil Vassilev
dac353c6df Each transaction has one wrapper function that we use all over.
Register the wrapper function in the transaction so that we can find it without
having to iterate over the rest of the declarations.


git-svn-id: http://root.cern.ch/svn/root/trunk@46672 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 11:49:49 +00:00
Vassil Vassilev
3fa63ae560 Make certain tests from the testsuite happy.
The issue was assert in codegen where the DeclRefExpr was built after the
declaration was extracted.


git-svn-id: http://root.cern.ch/svn/root/trunk@46671 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 10:46:53 +00:00
Vassil Vassilev
5b30c1e744 Why we didn't see that before. FileCheck is consuming the issued diagnostics,
which per se is terrible...


git-svn-id: http://root.cern.ch/svn/root/trunk@46669 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 10:07:41 +00:00
Vassil Vassilev
24cdb599f7 In many modes (eg like evaluate and value print) we need to find the last
expression in the wrapper function and do things with it. In some cases we 
must consider variable declarations as expressions (eg. int i = 5;) and take
the l-value and build a DeclRefExpr and return it.
Extract that common functionality out in a utility function and call it whenever
needed.


git-svn-id: http://root.cern.ch/svn/root/trunk@46668 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 09:22:36 +00:00
Vassil Vassilev
9fe2fb3239 Already in the mainline (r166208).
git-svn-id: http://root.cern.ch/svn/root/trunk@46665 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 08:05:57 +00:00
Vassil Vassilev
a209569ac5 * We need 0-terminated string (Thanks Axel for pointing that out) indeed.
* Add comment explaining it.
* Improve style of implementation.


git-svn-id: http://root.cern.ch/svn/root/trunk@46664 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-19 07:33:44 +00:00
Axel Naumann
9327a62ee1 Revert test r46655
git-svn-id: http://root.cern.ch/svn/root/trunk@46656 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 17:43:39 +00:00
Axel Naumann
5b0f6be89c Test for struct/class: who is complaining?
git-svn-id: http://root.cern.ch/svn/root/trunk@46655 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 17:42:39 +00:00
Vassil Vassilev
7f6039444b When we evaluate we *must* provide a value where the evaluated result to be stored
git-svn-id: http://root.cern.ch/svn/root/trunk@46642 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 12:24:04 +00:00
Vassil Vassilev
a952558fdc Reduce includes.
git-svn-id: http://root.cern.ch/svn/root/trunk@46640 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 12:10:29 +00:00
Vassil Vassilev
bdc04cd18e Extract the code duplication in separate routine.
git-svn-id: http://root.cern.ch/svn/root/trunk@46638 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 12:05:53 +00:00
Vassil Vassilev
f48a4881cd Add super efficient execute function. It doesn't do any fancy things with the
declarations - it just compiles and runs given expression or statement.


git-svn-id: http://root.cern.ch/svn/root/trunk@46636 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 11:56:20 +00:00
Vassil Vassilev
ff1861cfc2 Lit runs cling with --nologo.
git-svn-id: http://root.cern.ch/svn/root/trunk@46635 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 11:55:04 +00:00
Vassil Vassilev
2b27986ff9 Totally wrong assumptions. Pipe everything in FileCheck and we are done.
git-svn-id: http://root.cern.ch/svn/root/trunk@46633 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 10:25:24 +00:00
Vassil Vassilev
9ea3f22a54 Do not copy strings around when unneeded.
git-svn-id: http://root.cern.ch/svn/root/trunk@46632 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 09:43:05 +00:00
Vassil Vassilev
a907396350 Make it even simpler.
git-svn-id: http://root.cern.ch/svn/root/trunk@46631 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 09:38:39 +00:00
Vassil Vassilev
e8560dc77f This is definitely expected to fail.
git-svn-id: http://root.cern.ch/svn/root/trunk@46630 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 09:35:38 +00:00
Vassil Vassilev
59c03fda84 Simplify a bit the implementation. Make it more readable.
git-svn-id: http://root.cern.ch/svn/root/trunk@46629 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 09:33:29 +00:00
Vassil Vassilev
fe93a54d61 Silence doxygen warning.
git-svn-id: http://root.cern.ch/svn/root/trunk@46628 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-18 08:19:19 +00:00
Axel Naumann
a4ec8a554f Check for variables injected throug process being available on the prompt.
Check that redecl causes an error -- only the whole verify thing doesn't actually verify!
Also, the initializer should end up in the Value returned by evaluate; it's not!


git-svn-id: http://root.cern.ch/svn/root/trunk@46626 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 21:34:59 +00:00
Philippe Canal
d907f10347 Fix library order
git-svn-id: http://root.cern.ch/svn/root/trunk@46617 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 15:37:38 +00:00
Vassil Vassilev
94904e14ad Revert changes and add proper fix for the coverity issues.
git-svn-id: http://root.cern.ch/svn/root/trunk@46614 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 14:53:36 +00:00
Vassil Vassilev
3a180eb6b5 Remove confusing part of the comment.
git-svn-id: http://root.cern.ch/svn/root/trunk@46594 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 08:54:00 +00:00
Vassil Vassilev
ec129305af Centralize the unique name prefix (the names generated by the interpreter use it)
and provide utility function which checks if a decls has such name.


git-svn-id: http://root.cern.ch/svn/root/trunk@46593 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 08:52:24 +00:00
Vassil Vassilev
32a2b46db8 Use more meaningful compare instead of find.
git-svn-id: http://root.cern.ch/svn/root/trunk@46590 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 08:15:25 +00:00
Vassil Vassilev
aaab1dca48 We need to analyze the whole transaction. (Thanks Axel!)
git-svn-id: http://root.cern.ch/svn/root/trunk@46589 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-17 07:38:08 +00:00
Vassil Vassilev
1c2df25cdd Remove the / because the FileManager thinks it is a directory prefix and asserts
that the directory doesn't exist in its cache.
Bring us one step further in importing AST nodes.


git-svn-id: http://root.cern.ch/svn/root/trunk@46564 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-16 12:50:21 +00:00
Vassil Vassilev
df045c6cf4 It doesn't leak, it is refcounted by the compiler instance.
git-svn-id: http://root.cern.ch/svn/root/trunk@46560 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-16 09:58:08 +00:00
Axel Naumann
ebe948e9b0 If LLVMDEV is set, build a cling executable plus an environment that allows to cd interpreter/obj/tools/cling and run make test. Ugly but both temporary and non-public.
git-svn-id: http://root.cern.ch/svn/root/trunk@46557 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-16 00:51:45 +00:00
Vassil Vassilev
8358c3617e Default initialize for consistency.
git-svn-id: http://root.cern.ch/svn/root/trunk@46554 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 16:59:35 +00:00
Vassil Vassilev
ae3a0dfdad * Factor out the duplicate code.
* Avoid alloc/dealloc of the entire body of the function (the CompoundStmt) by
using ugly iterator + offset tricks.


git-svn-id: http://root.cern.ch/svn/root/trunk@46553 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 16:57:53 +00:00
Vassil Vassilev
2cdeefec33 Don't forget to update cmake build system.
git-svn-id: http://root.cern.ch/svn/root/trunk@46551 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 14:30:58 +00:00
Vassil Vassilev
21da904ea7 Make sure that the bug won't be reintroduced again.
git-svn-id: http://root.cern.ch/svn/root/trunk@46550 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 13:57:36 +00:00
Vassil Vassilev
c5a8df6c88 Prepare cling for fixing bug #98146. In principle the bug could be fixed in 10
seconds, but I don't like where EvaluateInternal is going.
At first place it shouldn't do any smart guessing what the transformers would do.
Second it shouldn't try to attach expression evaluation (storing the result in 
cling::Value) while preparing for value printing.

To sum up:
* Simplify the old craft in EvaluateInternal
  - Move the value printing logic into the value printer transformer. 
  - Move the expression evaluation login (mainly coming through the 
Interpreter::evaluate interface) into separate transformer.
* Attach the new transformer to the list of transformers (the size of it was 
increased as well.)
* Add new compilation option switch that the new transformer will react on.
* Turn on the switch where necessary.
* Simplify value printer logic. Now everything is at one place, which makes it
simpler and easier to debug.
* Make IncrementalParser::Parse to take compilation options' reference instead of
constructing it's own.
* As consequence of the new implementation - two bugs in the testsuite were 
uncovered. Propose a fix for them.
* Improve documentation.
* TODO: There is some code duplication, which will be factored out soon.


git-svn-id: http://root.cern.ch/svn/root/trunk@46549 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 13:42:09 +00:00
Vassil Vassilev
dd40e3966d Add space only if we have value to display.
git-svn-id: http://root.cern.ch/svn/root/trunk@46548 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-15 12:40:34 +00:00
Vassil Vassilev
1c6759298b Fix resource leak cid=#46296
git-svn-id: http://root.cern.ch/svn/root/trunk@46540 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 15:37:38 +00:00
Vassil Vassilev
f99d5ebd9d Try to fix #46418
git-svn-id: http://root.cern.ch/svn/root/trunk@46539 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 15:30:05 +00:00
Vassil Vassilev
fce967cd7d Coverity #46995
git-svn-id: http://root.cern.ch/svn/root/trunk@46538 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 15:23:14 +00:00
Vassil Vassilev
f022ae876f In principle this cannot happen because it is our controlled environment. However
one extra assertion doesn't hurt. (cid #47047)


git-svn-id: http://root.cern.ch/svn/root/trunk@46537 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 15:04:47 +00:00
Vassil Vassilev
0632a8e187 Initialize the variables to avoid dereferencing 0 (cid #47241)
git-svn-id: http://root.cern.ch/svn/root/trunk@46536 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 15:01:25 +00:00
Vassil Vassilev
ac49ac695f Initialize the variable to avoid dereferencing 0 (cid #47244)
git-svn-id: http://root.cern.ch/svn/root/trunk@46535 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 14:53:39 +00:00
Vassil Vassilev
f471d979b1 Indeed decl must not be null (coverity id #47522)
git-svn-id: http://root.cern.ch/svn/root/trunk@46534 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 14:43:29 +00:00
Vassil Vassilev
dc1bb6ee0e In priciple this could happen, but in practice it cannot. Nevertheless fix it and
make coverity happy (cid #47652)


git-svn-id: http://root.cern.ch/svn/root/trunk@46533 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 14:36:40 +00:00