2066 Commits

Author SHA1 Message Date
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
Vassil Vassilev
ca7d8a81e9 Don't check whether it exists or not just delete it.
git-svn-id: http://root.cern.ch/svn/root/trunk@46469 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-11 14:28:35 +00:00
Vassil Vassilev
23b6f09319 80 cols.
git-svn-id: http://root.cern.ch/svn/root/trunk@46468 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-11 14:27:56 +00:00
Vassil Vassilev
713470e077 I think LLVM guys like more static_cast-s instead of c-style casts. (Pointed out by Axel)
git-svn-id: http://root.cern.ch/svn/root/trunk@46465 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-11 14:04:19 +00:00
Vassil Vassilev
95acbcb2bb Multiplex the methods derived from ExternalASTSource as well.
git-svn-id: http://root.cern.ch/svn/root/trunk@46463 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-11 13:56:27 +00:00
Philippe Canal
0701fb4621 Update the test now that lookupFuncProto does overload resolution. Explicitly test paramter that are reference to object. Test case where we request only the non defaulted argument.
git-svn-id: http://root.cern.ch/svn/root/trunk@46455 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-11 00:07:55 +00:00
Paul Russo
bb8ebacdba Remove IsOverload() and FuncArgTypesMatch(),
they are no longer needed.

The referenceness of a dummy arg passed by reference
is carried in the value kind, and must be removed from
the type.


git-svn-id: http://root.cern.ch/svn/root/trunk@46454 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 22:55:40 +00:00
Paul Russo
3448b8772d Make findFunctionProto() do overload resolution, same as
findFuntionArgs().

These two functions are now so similar they can be combined
or turned into small wrappers around a common part.


git-svn-id: http://root.cern.ch/svn/root/trunk@46453 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 20:14:23 +00:00
Vassil Vassilev
3d9137f92a 80 column.
git-svn-id: http://root.cern.ch/svn/root/trunk@46452 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 18:33:06 +00:00
Vassil Vassilev
01b280b959 Remove commented code.
git-svn-id: http://root.cern.ch/svn/root/trunk@46451 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 18:23:31 +00:00
Vassil Vassilev
475ad9a757 * SymbolResolverCallback should create DynamicIDHandler as its InterpreterExternalSemaSource.
* InterpreterExternalSemaSource::setCallbacks is not needed any more. 
  It can be set in the constructor instead.


git-svn-id: http://root.cern.ch/svn/root/trunk@46444 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 15:50:17 +00:00
Vassil Vassilev
9d654b26f9 No need to enable/disable, check for enabled/disabled callback. Either they are
there and we use them or not.


git-svn-id: http://root.cern.ch/svn/root/trunk@46440 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 14:50:45 +00:00
Vassil Vassilev
a047926b87 Usually we have to distinguish between lookup failures. Eg. there are certain
lookups that are expected (by the compiler) to fail and those which should not fail.

I was misled (wasn't thinking at all: Thanks Axel for questioning the checkin) 
because I thought we cannot distinguish those two different cases in the test
callback. 
Silly mistake:
  Revert the changes in the testsuite.
  Revert the default setup of the test callback in enableDynamicLookup

The problem is solved by extracting out the function which determines whether
a lookup is not expected to fail. (It still needs better place.)


git-svn-id: http://root.cern.ch/svn/root/trunk@46438 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 14:37:10 +00:00
Vassil Vassilev
3bba03cf9f *The JIT is configured to compile with RTTI so when we #include the SymbolResolverCallback
it looks for typeinfo of the InterpreterCallbacks (compiled with fno-rtti).

*Move the SymbolResolverCallback into InterpreterCallbacks.(h,cpp). Ideally it is 
used only in the testsuite so we could hack in the build system to build the 
SymbolResolverCallback with fno-rtti and include just the header file but that's
for later.
*Set the symbol resolver callback in enableDynamicLookup for now.
*Clear up the logic behind InterpreterExternalSemaSource and InterpreterCallbacks.
*Now the DynamicIDHandler derives from InterpreterExternalSemaSource.
*Adapt the testsuite to the change.
*Request the InterpreterCallback constructor to be put in the binary.


git-svn-id: http://root.cern.ch/svn/root/trunk@46435 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 13:00:17 +00:00
Vassil Vassilev
db2643ae31 Don't forget to add the old ExternalSemaSource.
git-svn-id: http://root.cern.ch/svn/root/trunk@46434 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-10 11:47:26 +00:00
Vassil Vassilev
a6a7c6f748 No need of -verify and -I for that test.
git-svn-id: http://root.cern.ch/svn/root/trunk@46410 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 16:09:42 +00:00
Vassil Vassilev
48d25b94e0 Add the InterpreterCallbacks.cpp to cmake build system.
git-svn-id: http://root.cern.ch/svn/root/trunk@46399 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 10:29:44 +00:00
Vassil Vassilev
8425f2b743 Register the patch so that EC can be happy while building the nightlies.
git-svn-id: http://root.cern.ch/svn/root/trunk@46398 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 10:26:14 +00:00
Vassil Vassilev
98cbfe380a The ExternalSemaSource mentioned in the previous commit message is thought (in clang)
to be a single object.
ASTReader (aka PCM reader) attaches itself as an ExternalSemaSource.
When cling attaches a callback class and the ASTReader attaches itself they step
on one another's feet.

The patch implements in clang the notion of multiplex ExternalSemaSources and 
adapts cling to make use of it. It will be soon proposed to end up in clang
mainline.


git-svn-id: http://root.cern.ch/svn/root/trunk@46397 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 10:21:17 +00:00
Vassil Vassilev
e75c9b1a13 The callback class implements LookupObject callback, which should be called even
no dynamic scopes are involved. The information about a failed lookup comes from 
slightly different channel - ExternalSemaSource (if attached to sema).

In order to make the callback LookupObject work when we attach an arbitrary 
callback class we should attach ExternalSemaSource to Sema as well. This require
a default implementation for an ExternalSemaSource.


git-svn-id: http://root.cern.ch/svn/root/trunk@46396 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 10:17:19 +00:00
Vassil Vassilev
6e341e8376 Implement functions that check whether a name was interpreter-generated.
git-svn-id: http://root.cern.ch/svn/root/trunk@46395 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 09:48:54 +00:00
Vassil Vassilev
a67f0ebca8 * Add another overload taking DeclarationName as an argument. This is useful when
we have to deal with failed lookups.
* Improve documentation.


git-svn-id: http://root.cern.ch/svn/root/trunk@46394 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-09 09:41:26 +00:00
Vassil Vassilev
9ac54aa5d9 Replace tabs with spaces.
git-svn-id: http://root.cern.ch/svn/root/trunk@46379 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-08 10:38:52 +00:00
Axel Naumann
f40d413b7f Be more verbose about missing symbols.
git-svn-id: http://root.cern.ch/svn/root/trunk@46375 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-07 11:53:16 +00:00