Commit Graph

5239 Commits

Author SHA1 Message Date
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
Vassil Vassilev
d444bf0c83 Fix memory leak (coverity #47844)
git-svn-id: http://root.cern.ch/svn/root/trunk@46532 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 14:26:10 +00:00
Vassil Vassilev
20f78c8af1 The external sema source should be set in the constructor of the interpreter
callbacks.
Fixes coverity complaint #47859


git-svn-id: http://root.cern.ch/svn/root/trunk@46531 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 14:20:08 +00:00
Vassil Vassilev
31b81f4212 Silence coverity #47876.
git-svn-id: http://root.cern.ch/svn/root/trunk@46528 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 12:01:32 +00:00
Vassil Vassilev
dfa21b692d Initialize the class member in the ctor (silence coverity #47883)
git-svn-id: http://root.cern.ch/svn/root/trunk@46527 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 11:58:56 +00:00
Vassil Vassilev
3fd23f9b70 Remove debug code.
git-svn-id: http://root.cern.ch/svn/root/trunk@46526 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-14 11:44:16 +00:00
Vassil Vassilev
a26dec6bb1 Adapt to the newest changes in clang (in dyn_cast/isa support).
git-svn-id: http://root.cern.ch/svn/root/trunk@46525 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-13 15:04:49 +00:00
Vassil Vassilev
b831a3e15f Remove unused variable.
git-svn-id: http://root.cern.ch/svn/root/trunk@46524 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-13 15:03:58 +00:00
Vassil Vassilev
01896277e2 Centralize the common code in to a method and just call it. Reduces a *lot* the
code duplication.
Adjust the creation of ParserStateRAII object used to recover the parser on exit.


git-svn-id: http://root.cern.ch/svn/root/trunk@46510 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-12 16:09:04 +00:00
Vassil Vassilev
be7177b93c Extract out the common part of setting up and recovering the parser.
git-svn-id: http://root.cern.ch/svn/root/trunk@46508 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-12 15:27:02 +00:00
Axel Naumann
81908ad423 Fix warning (un/signed comparison)
git-svn-id: http://root.cern.ch/svn/root/trunk@46500 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-12 14:28:12 +00:00
Axel Naumann
cc0174e1c3 Handle non-pointer results of which StoredValue believes that they should not be stored in a GenericValue.
So far the only case observed is "Root":
the JIT stores it as a [5 x i8] = i40 (no kidding);
StoredValue says it should go onto the heap (or its member buffer) as it's an array.
Now the StoredValue knows where to get the array's values from.


git-svn-id: http://root.cern.ch/svn/root/trunk@46494 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-12 13:36:23 +00:00
Axel Naumann
4908b97968 Don't allocate twice for small values.
The StoredValue has to be heap allocated, so it can be deleted when refcount == 0.
But the value it points to now is simply contained inside the StoredValue if
* it fits into the GenericValue (double,...)
* it is <= 80 bytes.
This grows StoredValue (not Ref!) from 48 to 128 bytes on Linux 64bit.
Given that many OSes allocate an extra 16 bytes for each allocation (i.e. the actual cost is 80-16 bytes), this is still reasonable.


git-svn-id: http://root.cern.ch/svn/root/trunk@46491 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-12 13:22:12 +00:00