Commit Graph

106 Commits

Author SHA1 Message Date
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
Vassil Vassilev
6fd2a83a5c Revert previous change which broke cling's testsuite.
The issue that was addressing the previous commit will be fixed with the upcoming
changes anyway.


git-svn-id: http://root.cern.ch/svn/root/trunk@46345 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 14:03:29 +00:00
Vassil Vassilev
2fbeb6ecd4 The callback goes first.
git-svn-id: http://root.cern.ch/svn/root/trunk@46342 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 13:19:18 +00:00
Axel Naumann
0a9ed8027c Remove cling::Value-compatible overloads.
Use "m_" as member prefix.
Remove adopt() - not needed.
Remove hasValue() - it's meaningless (use isValid() to check validity of value).


git-svn-id: http://root.cern.ch/svn/root/trunk@46341 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 13:10:28 +00:00
Axel Naumann
abdd03925f update cmake config file.
git-svn-id: http://root.cern.ch/svn/root/trunk@46338 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 13:01:15 +00:00
Axel Naumann
bc18a88f10 Essential part of r46334. Log was:
Add cling::StoredValueRef: a ref-counted value with automatic storage management.
Update Interpreter to use that instead of cling::Value.
This fixes an issue where the called neded to guess the return type of the wrapper function, such that for instance Interpreter::Evaluate() has storage for the wrapper's aggregate SRet return value if needed.
Instead, the Interpreter now allocates the proper storage for return values, and hands out references to it.
StoredValueRef is tiny (8bytes on 64bit Linux); default allocation is cheap.


git-svn-id: http://root.cern.ch/svn/root/trunk@46335 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 12:18:14 +00:00
Axel Naumann
3ec1741cf9 Add cling::StoredValueRef: a ref-counted value with automatic storage management.
Update Interpreter to use that instead of cling::Value.
This fixes an issue where the called neded to guess the return type of the wrapper function, such that for instance Interpreter::Evaluate() has storage for the wrapper's aggregate SRet return value if needed.
Instead, the Interpreter now allocates the proper storage for return values, and hands out references to it.
StoredValueRef is tiny (8bytes on 64bit Linux); default allocation is cheap.

Update TCintWithCling and friends; don't pass the returnValue in if the caller does not need it.
TClingCallFunc: provide storage for fArgs.


git-svn-id: http://root.cern.ch/svn/root/trunk@46334 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 12:09:51 +00:00
Vassil Vassilev
5e4f599000 Typo.
git-svn-id: http://root.cern.ch/svn/root/trunk@46331 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-05 10:32:03 +00:00
Vassil Vassilev
f8d42d206f Add sensible constructor.
git-svn-id: http://root.cern.ch/svn/root/trunk@46319 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-04 16:03:05 +00:00
Vassil Vassilev
a7261215a3 Add multiplex external sema source, which is a list of sema sources. When it is
used it dispatches the events to every element of the list of sources.

This is used because we want to have ASTDeclReader and our custom external source
catching LookupUnqualified callbacks, happening on failed lookup.


git-svn-id: http://root.cern.ch/svn/root/trunk@46317 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-04 15:47:10 +00:00
Vassil Vassilev
a255ebf4de Clarify ownership.
git-svn-id: http://root.cern.ch/svn/root/trunk@46316 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-04 15:44:50 +00:00