180 Commits

Author SHA1 Message Date
Vassil Vassilev
1ee8915aa6 Since we enforced very strict policy when declarations should be added to a transaction we have corner cases which need to be handled. For example in the transaction transformers there could be template instantiations happening and the transaction should be open and expecting decls. 2013-06-25 09:30:34 +02:00
Vassil Vassilev
ebd1976bf3 No Constness and semi needed anymore. 2013-06-25 09:30:31 +02:00
Vassil Vassilev
87a4b6bd63 From Baozeng: Add .printIR meta command, printing the llvm::Module. 2013-06-17 21:00:58 +02:00
Axel Naumann
09bf261456 Fix for __float128 / c++11; define __CLING__CXX11 for c++11 2013-06-13 14:03:03 +02:00
Axel Naumann
11e71f5c76 Make result evaluation optional again. 2013-06-10 17:12:50 +02:00
Axel Naumann
0c1c22f002 Return action result and Value from all interfaces. Force callers to rpovide them, to make them handle errors etc. 2013-06-07 15:19:51 +02:00
Vassil Vassilev
53d39b672e Revert "Nested transactions share the parent's llvm::Module."
This reverts commit 9ae79df05006247cfed1e7e89e0fd371f3eba459.
2013-06-05 16:26:51 +02:00
Vassil Vassilev
947054ccec Revert "Constness and semi."
This reverts commit bbb8e62b1d8bc58ec157cb2ad8e0fe67f751a6ca.
2013-06-05 16:26:51 +02:00
Vassil Vassilev
e74e7655d0 Revert "Progress on the llvm multi-module support."
This reverts commit 9d78faef6a45cb16c05fe7a96d9e2eb9fb2c1298.
2013-06-05 16:26:51 +02:00
Vassil Vassilev
b1d11c2987 Progress on the llvm multi-module support.
Now we build a llvm::Module per cling::Transaction and link them in on commit.
2013-06-05 16:26:51 +02:00
Vassil Vassilev
52b5d39f7d Constness and semi. 2013-06-05 16:26:50 +02:00
Vassil Vassilev
42c4d235a2 Nested transactions share the parent's llvm::Module. 2013-06-05 16:26:50 +02:00
Axel Naumann
334b389936 Move delimiter / separator printing to caller. 2013-05-15 11:43:12 +02:00
Axel Naumann
4219c4e1a9 Split value printing interface into printValue(), printType().
TString is missing a newline; will refactor printing of delims (to be done by pcaller).
2013-05-15 11:43:12 +02:00
Axel Naumann
9a9f49f129 printValue() now returns a std::string to reduce dependency on cling / llvm. 2013-05-15 11:43:12 +02:00
Axel Naumann
3a5d293518 Fix documentation. 2013-05-15 11:43:12 +02:00
Axel Naumann
f507a8da1b Rename public value printer function to cling::printValue. 2013-05-15 11:43:12 +02:00
Vassil Vassilev
782d2568ea Factor our common functionality and replace CreateTypeSourceInfo with getTrivialTypeSourceInfo.
git-svn-id: http://root.cern.ch/svn/root/trunk@49347 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-25 12:48:15 +00:00
Axel Naumann
70695fe2be Update to clang/llvm r179269 (llvm vendor branch r49215):
Parser::Scope versus Sema::DeclContext are now checked for cross-vailidity.
Emit the TU-transaction explicitly instead of relying on a first transaction.
The typename extraction now takes a stream instead of a string to write to.
The llvm::Linker has much reduced functionality; use llvm::sys::Path instead to find dynamic libraries.


git-svn-id: http://root.cern.ch/svn/root/trunk@49325 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 16:28:08 +00:00
Vassil Vassilev
343a649e42 Reorder enum. Add enum constant for the size, fix a wrong condition in an assert.
git-svn-id: http://root.cern.ch/svn/root/trunk@49320 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 15:04:09 +00:00
Vassil Vassilev
5e47631c1c Check whether the begun transaction is the one being committed.
git-svn-id: http://root.cern.ch/svn/root/trunk@49315 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 12:53:08 +00:00
Vassil Vassilev
a02f334f7f Don't be too harsh if somebody asks for the last nested transaction.
git-svn-id: http://root.cern.ch/svn/root/trunk@49314 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 12:52:07 +00:00
Vassil Vassilev
852606b028 Reuse the empty nested transactions too.
git-svn-id: http://root.cern.ch/svn/root/trunk@49307 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 09:57:30 +00:00
Vassil Vassilev
2d770ce24c Move resetting of the transaction in the transaction itself.
git-svn-id: http://root.cern.ch/svn/root/trunk@49303 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 09:06:58 +00:00
Vassil Vassilev
0fac9d5de3 Empty is a transaction with no decls and no nested transactions.
git-svn-id: http://root.cern.ch/svn/root/trunk@49302 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 08:51:27 +00:00
Vassil Vassilev
8817cef9ca Reduce the creation of empty top-most transactions. Instead if the last
transaction was empty just reuse it.


git-svn-id: http://root.cern.ch/svn/root/trunk@49301 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-24 06:55:38 +00:00
Vassil Vassilev
ec7bc1e519 Move the set of llvm::Module from the Transaction ctor to commitTransaction.
git-svn-id: http://root.cern.ch/svn/root/trunk@49295 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-23 21:36:41 +00:00
Axel Naumann
48b4a4e934 For Decls coming from a parsed file that describes the content of a library:
the callbacks must be triggered for those, too.
As they are not part of a transaction (think "module") they are now sent to the deserialization listener.
This can be removed once the modules work.

Set the state of the transaction to Committing before the static init - which might trigger more decls even though CodeGen has been run over the decls.

Forward DeclCollector::HandleInterestingDecl() to DeclCollector::HandleTopLevelDecl() for decls from the AST reader / from headers describing libraries.

Empty transactions must be passed to TCling; they trigger the sending of deserialized decls to ROOT/Meta.

Don't start TCling's artificial TU Transaction if the transaction coming in is empty - we need a decl to get the ASTContext.

Swap the deserialized decls before handling them in TCling, such that nested calls don't see the same decls again.


git-svn-id: http://root.cern.ch/svn/root/trunk@49197 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-10 15:15:49 +00:00
Vassil Vassilev
3ce238085f Reorder: put the nested transaction container right after the decl container.
git-svn-id: http://root.cern.ch/svn/root/trunk@49140 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 08:55:54 +00:00
Vassil Vassilev
4760be34eb Remove redundant method. Improve style.
git-svn-id: http://root.cern.ch/svn/root/trunk@49138 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 08:44:51 +00:00
Vassil Vassilev
564659c170 Fix a misnomer.
git-svn-id: http://root.cern.ch/svn/root/trunk@49125 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 14:35:35 +00:00
Vassil Vassilev
df0dc16c07 Make cling::Transaction cheaper to construct. Lazy-create the container of the
nested transactions. 

Now sizeof(cling::Transaction()) == 56.


git-svn-id: http://root.cern.ch/svn/root/trunk@49124 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 14:27:57 +00:00
Axel Naumann
a91112365b Add documentation!
git-svn-id: http://root.cern.ch/svn/root/trunk@49105 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 21:55:12 +00:00
Axel Naumann
2e153295ff Make the default compilation options compatible with a compiler.
Add comparison ops: I needed them for a dead end and now I have them and the compiler won't generate its own.


git-svn-id: http://root.cern.ch/svn/root/trunk@49101 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 15:10:05 +00:00
Axel Naumann
8c680be610 Implement hasFunction().
Rephrase !(a==b).

This file still needs major refactoring to remove code duplication.


git-svn-id: http://root.cern.ch/svn/root/trunk@49099 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:50:01 +00:00
Axel Naumann
89d418feb6 Remove Completed flag; integrated it into state:
collecting->completed->committing->committed
Make m_DeclQueue lazily allocated to reduce sizeof(Transaction) in an effort to make the TransactionRAII cheaper - second part is coming up.
Remove unused thus unneeded and annoying (non-const) iterator interfaces; they clash with the constness of the EmptyQueue.


git-svn-id: http://root.cern.ch/svn/root/trunk@49097 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:43:01 +00:00
Axel Naumann
ce0752f698 Rename state kUnknown to kCollecting.
Implement Transaction::printStructure().
Remove unnecessary non-const overload of getWrapperFD().


git-svn-id: http://root.cern.ch/svn/root/trunk@49095 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:12:57 +00:00
Vassil Vassilev
1e8aee2da4 Resurrect the trunk:
The issue is that sometimes we don't have a begun transaction. This can happen
mostly in cases when the code doesn't come from text representation but:
  * From lookup, where template is being instantiated
  * From a PCH/PCM, where a decl was deserialized.

This patch solves the first case: When we do findScope we have to instantiate
the declaration if needed.
Every time there is a chance that generated code's declarations can be orphaned,
we have to explicitly push a transaction so that we can keep the integrity.


git-svn-id: http://root.cern.ch/svn/root/trunk@49070 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-03 16:25:08 +00:00
Vassil Vassilev
2b054ac81d Remove files from cling's trunk. They are in clang's mainline and our vendor drop.
git-svn-id: http://root.cern.ch/svn/root/trunk@49069 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-03 14:55:23 +00:00
Axel Naumann
8389c5b1e1 Merge development from branches/dev/root6-pch into the trunk: enable PCH for ROOT.
git-svn-id: http://root.cern.ch/svn/root/trunk@48958 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-27 18:07:03 +00:00
Axel Naumann
4a0c1c6e1f Merge with trunk, r48857 - r48937.
git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48938 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-26 15:23:24 +00:00
Vassil Vassilev
25e1924b5f *Lay the foundation of return by-value support.
Some functions return temporary objects. Eg:

  std::string getName() {
    return "ROOT";
  }

  In that case the lifetime of the temporary variable is defined by the caller. 
  Such function called by TClingCallFunc would cause undefined behaviour, because
  there is no actual caller and the compiler cannot define any lifetime. 

  In order to provide such concept we have implemented cling::StoredValueRef, which
  is a reference counted cling::Value. As long as somebody "has" a copy of it, the
  boxed value (and the occupied memory) will live.

  However cling::Value and cling::StoredValueRef expose LLVM/clang/cling internals
  to ROOT. We want to avoid for now exposing LLVM/clang/cling internals, so we have
  TInterpreterValue, which makes cling::StoredValueRef opaque.

*New interface taking TInterpreterValue is added to the TInterpreter to allow the
users to manage the lifetime of the returned temporaries.

*Replace the occurrances of cling::Value with cling::StoredValueRef to avoid 
any lifetime management issues.

*Minor optimizations of the existing implementation

*Tweaks to the build system so that TInterpreterValue.cxx could 
#include cling/Interpreter/StoredValueRef.h

PLEASE NOTE: This is not the final implementation it needs polishing. Eg. there
is a bug that should be fixed soon, which doesn't allow to get the actual result
out of the TInterpreterValue.


git-svn-id: http://root.cern.ch/svn/root/trunk@48895 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-18 21:30:00 +00:00
Fons Rademakers
a3cb06c5e6 Fixes for compiling with C++11 and libcxx on OSX.
git-svn-id: http://root.cern.ch/svn/root/trunk@48886 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-17 13:31:45 +00:00
Axel Naumann
0de0164c3f Add a deserialization listener: we do not receive all decls through the ASTConsumer interface.
git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48864 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-13 09:26:55 +00:00
Axel Naumann
77ba6929b0 v5 of patches.
Remaining:
* callfunc issues finding functions
* vtable issues (likely related)
* in stressHistogram: Test  3: Projection with Range for Histograms and Profiles................OK
  Error in <TStreamerInfo::Build>: TProfile, unknown type: EErrorType fErrorMode


git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48858 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-11 13:11:15 +00:00
Axel Naumann
5408532f3b Don't expose DynamicLookupRuntimeUniverse.h to G__Meta.o (missing symbol gCling).
Reshuffle gCling; definition is now provided by the Interpreter internally, not in any header.
This will cause missing symbols in libraries instead of silently creating dumplicated (JIT / library).
Still requires Vassil to add a parameter to LifetimeHandler() - but this will cause a cling test failure as a reminder.


git-svn-id: http://root.cern.ch/svn/root/trunk@48817 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-05 17:03:49 +00:00
Vassil Vassilev
e6a53da83d Add documentation and silence doxygen warning.
git-svn-id: http://root.cern.ch/svn/root/trunk@48812 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-05 11:18:59 +00:00
Vassil Vassilev
12a6b029e3 Typo.
git-svn-id: http://root.cern.ch/svn/root/trunk@48762 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-28 10:03:29 +00:00
Axel Naumann
1acbc2d486 GenericValue::op= is smart; it takes *this into account.
That won't work for construction; so replace with placement new.
Also need default c'tor for Value() to initialize m_GV correctly.


git-svn-id: http://root.cern.ch/svn/root/trunk@48709 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-26 11:14:05 +00:00
Axel Naumann
46bd172859 Add proper include guard.
This header gets included by enabling dynamic lookup, and by RegisterModule() of G__Meta.
We need the latter for the many-pcm case.


git-svn-id: http://root.cern.ch/svn/root/trunk@48703 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-26 09:46:50 +00:00