498 Commits

Author SHA1 Message Date
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
Vassil Vassilev
ee2372ae3f Implement support of implicit (C++11) auto keyword.
Now we support name = initializer; style syntax, which gets transformed semantically
into auto name = initializer; Eg. i = 45;
The underlying mechanics are similar to the dynamic scopes. We "heal" the failed
lookup of "name" and then transform the created by Sema binary operator into a 
declaration statement after making the type deduction.

Note that the code in the TClingCallbacks could and will be extracted in cling's
codebase.


git-svn-id: http://root.cern.ch/svn/root/trunk@48736 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-27 15:28:38 +00:00
Axel Naumann
96b10954c4 Don't crash when emitting diagnostics during startup, but set up diag client before doing the runtime includes.
git-svn-id: http://root.cern.ch/svn/root/trunk@48732 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-27 15:05:21 +00:00
Axel Naumann
8258396916 Add missing headers, included by cling::Interpreter c'tor.
Fixes crash on optimized builds.


git-svn-id: http://root.cern.ch/svn/root/trunk@48731 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-27 15:04:39 +00:00
Axel Naumann
94a345f528 Modules can be enabled through flags into Interpreter()
git-svn-id: http://root.cern.ch/svn/root/trunk@48716 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-26 14:41:08 +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
Vassil Vassilev
a343830c5b Create and initialize the type source info. Avoids crashes in the AST build by
the dynamic scopes.


git-svn-id: http://root.cern.ch/svn/root/trunk@48701 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 17:09:57 +00:00
Axel Naumann
38fd2bc3c5 Copy headers only after llvm has been built, i.e. don't make ALLHDRS depend on it.
Remove unused rule.


git-svn-id: http://root.cern.ch/svn/root/trunk@48697 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 16:25:39 +00:00
Axel Naumann
eae6e6b760 Update the *massively* reduced list of headers we need for runtime.
git-svn-id: http://root.cern.ch/svn/root/trunk@48692 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 16:00:51 +00:00
Axel Naumann
b364112d1d Don't expose SmallVector (which needs DataTypes.h).
Use vector instead.


git-svn-id: http://root.cern.ch/svn/root/trunk@48691 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 15:54:36 +00:00
Axel Naumann
5279835d41 Add explicit copy c'tor + assign op so no uninit memory gets copied.
git-svn-id: http://root.cern.ch/svn/root/trunk@48689 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 15:20:49 +00:00
Axel Naumann
9d69f41211 Move llvm::sys::DynamicLibrary out of the Interpreter header.
git-svn-id: http://root.cern.ch/svn/root/trunk@48685 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 13:38:54 +00:00
Axel Naumann
87356648fb Indentation, use using directive.
git-svn-id: http://root.cern.ch/svn/root/trunk@48684 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 13:15:35 +00:00
Axel Naumann
c835d37455 Don't store Paths but strings. Reduces dependencies.
git-svn-id: http://root.cern.ch/svn/root/trunk@48683 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 13:14:24 +00:00
Vassil Vassilev
edcc7a51fa Reduce fwd decls.
git-svn-id: http://root.cern.ch/svn/root/trunk@48680 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 10:19:15 +00:00
Axel Naumann
2ac4022b04 Add missing file.
git-svn-id: http://root.cern.ch/svn/root/trunk@48679 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 07:51:21 +00:00
Axel Naumann
e5a34d0f47 Add new file.
git-svn-id: http://root.cern.ch/svn/root/trunk@48678 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-25 07:47:39 +00:00
Axel Naumann
40ef9800f6 Try to load the header from a module, if that fails: include the header.
Fixes cling test suite.


git-svn-id: http://root.cern.ch/svn/root/trunk@48676 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-22 16:35:15 +00:00
Axel Naumann
664e8b22ac Reduce the amount of headers needed by the dynamic scopes at runtime:
* Make GenericValue, clang::QualType opaque in Value
* Move LifetimeHandler implementation into source; requires separate header
* 

Also:
* Value: replace CPP macros by overloads


git-svn-id: http://root.cern.ch/svn/root/trunk@48675 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-22 15:59:54 +00:00
Axel Naumann
e0397a6d4c Be specific about which gCling we are talking about (ROOT has its own...)
git-svn-id: http://root.cern.ch/svn/root/trunk@48667 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-21 17:34:59 +00:00
Axel Naumann
fd45ec84c1 Don't create a variable of type __trigger__cxa_atexit; that's only needed for the header to convince the JIT to codegen its d'tor (it will create dupe symbols when compiling the dictionary otherwise).
Use loadModuleForHeader() for DynamicLookupRuntimeUniverse.h - we need to find a way to determine whether CodeGen needs to run on an include (i.e. whether it's from a PCM) or not.


git-svn-id: http://root.cern.ch/svn/root/trunk@48665 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-21 17:31:30 +00:00
Axel Naumann
711f95413f Fix rules for etc/cling/Interpreter and friends.
git-svn-id: http://root.cern.ch/svn/root/trunk@48664 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-21 17:28:27 +00:00
Vassil Vassilev
d0af24b957 From Axel and me: As a mid-term solution copy some LLVM and clang header files
in ROOT's etc/cling.


git-svn-id: http://root.cern.ch/svn/root/trunk@48641 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-19 14:14:07 +00:00
Vassil Vassilev
58b3a268a6 Enhance the LookupHelper's findScope to return decls for non enum types.
git-svn-id: http://root.cern.ch/svn/root/trunk@48639 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-19 09:30:00 +00:00
Vassil Vassilev
8e45223665 Remove accidentally checked in ;
git-svn-id: http://root.cern.ch/svn/root/trunk@48638 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-19 09:28:40 +00:00
Vassil Vassilev
3f1ede3564 Remove accidentally checked in code.
git-svn-id: http://root.cern.ch/svn/root/trunk@48637 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-19 09:26:54 +00:00
Vassil Vassilev
649f9c47d4 Improve style
git-svn-id: http://root.cern.ch/svn/root/trunk@48635 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-19 09:25:04 +00:00
Vassil Vassilev
a526b217e0 Explicit template instantiations should end up on the global scope.
Fixes: http://savannah.cern.ch/bugs/?100449


git-svn-id: http://root.cern.ch/svn/root/trunk@48618 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-18 13:22:39 +00:00
Philippe Canal
e5d5914ccb Add missing null pointer protection
git-svn-id: http://root.cern.ch/svn/root/trunk@48595 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-15 12:42:09 +00:00
Philippe Canal
e869ee0993 Add testing of the desugaring behavior of typdef inside std
git-svn-id: http://root.cern.ch/svn/root/trunk@48577 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-14 17:45:49 +00:00
Vassil Vassilev
3bcfc8b25e Prepare dynamic scopes for integration in ROOT;
* Merge the DynamicIDHandler into InterpreterCallbacks. The DynamicIDHandler was
used to define the failed lookup names as dependent, so that later on they could
be "healed" by the EvaluateTSynthesizer - by generating a call to gCling->EvaluateT...

* Add a flag in the InterpreterCallbacks giving a hint when the failed lookup is
performed - during compilation time or during evaluation type, maybe its name is
misnomer. Maybe I should rename it to IsInRuntimeEvalMode or smth like that...

* Simplify the evaluation routine. The idea is to be merged with one of the 
existing - either echo or evaluate

* Implement proper mock object as test dynamic symbol resolver callback. Now it
fully relies on InterpreterCallbacks.

* Implement dynamic expression node marking. Every node that needs runtime 
resolution is marked as dependent. However, clang marks other nodes as dependent,
too (eg. templates). Until now it was very difficult to distinguish between both.
Now every "artificially" (marked by us) node's declaration is annotated so that 
it could be found back easily by using a simple RecursiveASTVisitor.

Generally we have two issues when using dynamic scopes - filtering the failed 
lookups that need to be evaluated at runtime, and filtering the "artificially"
marked as dependent dynamic nodes/decls. Whereas the second issue is solved by
using the annotations, the first one is more tricky to solve because clang doesn't
give us enough information to conclude what should be done. For now I have 
narrowed down the cases so that dynamic nodes can appear only in function decls.


git-svn-id: http://root.cern.ch/svn/root/trunk@48575 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-14 17:29:30 +00:00
Philippe Canal
4c4a43770d Switch from not desugaring *all* typedef that are declared within a class or namespace inside std to not desugaring the typedef that are declared in std and are pointing to a class, enum or struct that is declared in std or __gnu_cxx (or a class or namespace nested within those namespaces).
This revises the behavior introduced in revision 46131.
This fixes <https://savannah.cern.ch/bugs/?100390>

Philippe.


git-svn-id: http://root.cern.ch/svn/root/trunk@48574 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-14 17:23:47 +00:00
Philippe Canal
578fbe2a93 Disable the warning about uninitialized field when parsing a header from a module ... this avoid complaining about a (real) bug in QT headers
git-svn-id: http://root.cern.ch/svn/root/trunk@48572 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-14 17:10:38 +00:00
Vassil Vassilev
ca634731e2 Tabs.
git-svn-id: http://root.cern.ch/svn/root/trunk@48569 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-14 11:36:41 +00:00
Philippe Canal
a7f6d5c3c9 Finish 48510 SubstTemplateTypeParmType can indeed carry meaningfull qualifier (also add related test)
git-svn-id: http://root.cern.ch/svn/root/trunk@48549 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-12 18:38:58 +00:00
Vassil Vassilev
729b170788 Enrich the implementaion of Interpreter::mangleName, make it public and rename it
to maybeMangleDeclName (which is more talkative).
Use Interpreter::maybeMangleDeclName instead of duplicating code.


git-svn-id: http://root.cern.ch/svn/root/trunk@48545 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-12 15:38:44 +00:00
Vassil Vassilev
7abc2a8334 Add support in TClingCallFunc for calling virtual functions: when we have a
CallFunc representation of a member function, we have its concrete address, and
if there is derived class there is no way how to evaluate the vtable and call the
correct virtual.

In order to evaluate the member's vtable, we either have to calculate it (which
is platform/implementation dependent) or create a trampoline function which calls
the target function. Thus codegen will generate code for vtable evaluation. The
trampolines are created for functions that could be possibly virtual - non-static
member functions, declared as virutal. A trampoline looks like this:

void unique_name(Base* This, MyClass2* a, MyClass3* b, double c, MyClass* ret) {
  if (ret) 
    *ret = This->function(*a, *b, c);
  else 
    This->function(*a, *b, c);
}

where we pass in explicitly the address that CallFunc is given (This), followed
by set of arguments (possibly needing conversion) and if the target is non-void
a last argument that is used to provide a storage for the return result.

The given arguments and the required by *LLVM* IR may differ - in that case 
simple argument conversions are done. For now primary pointers and builtins, which
covers pretty much entire LLVM type system.

Note that the first implementation is very rough and suboptimal, however it is 
very good starting point (milestone):
* Common code is extracted out in its separate routines (here a lot of refactoring more
could be done).
* cling::Value now stores besides clang::QualType, describing (soft-of inaccurately)
the llvm::GenericValue, LLVM-type which is the actual description of the generic value.
* cling::Value naming conventions improved;
* cling::Interpreter::getLLVMType is added temporarily and soon will be removed.

* TClingCallFunc now preallocates space for the this ptr and the return result.
(instead of multiple array copies)
* TClingCallFunc now stores not llvm::GenericValues but cling::StoredValueRefs
because the type conversions need llvm::GenericValue's description (which 
essentially is the type).
* Does better default argument evaluation: it could be even *more betterer* if
we query Sema to fold for us the constant expressions instead of decompiling them
to source and using cling for evaluation.
* Return storage implemented.


And, yes that is the longest commit message in my life...
Implementation of argument conversion is revised.


git-svn-id: http://root.cern.ch/svn/root/trunk@48537 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-11 17:30:03 +00:00
Vassil Vassilev
d14cab524a Add TODO.
git-svn-id: http://root.cern.ch/svn/root/trunk@48536 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-11 17:03:50 +00:00
Vassil Vassilev
7832135a63 * Move the check whether a symbol is dynamic from the testsuite to the "mainline".
* Add the dynamic ID handler, responsible for the dynamic scopes, as ExternalSemaSoruce
for the TClingCallbacks. 

From here on we don't know how many tests will fail due to that.
I might end up reverting it if they are too many.


git-svn-id: http://root.cern.ch/svn/root/trunk@48529 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-11 13:19:55 +00:00
Vassil Vassilev
042f5d6eba Remove extra newline.
git-svn-id: http://root.cern.ch/svn/root/trunk@48528 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-11 12:56:00 +00:00
Vassil Vassilev
8c2ccd177f Move the DynamicIDHandler into separate source file so that it could be used while
implementing custom interpreter callbacks.


git-svn-id: http://root.cern.ch/svn/root/trunk@48527 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-11 12:55:01 +00:00
Philippe Canal
5895324cbb Add missing return statement
git-svn-id: http://root.cern.ch/svn/root/trunk@48520 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-08 20:46:52 +00:00
Paul Russo
1737ff69c7 Change TCling::ResetGlobals() to invoke the global destructors.
This fixes roottest workaround ClingWorkAroundIncorrectTearDownOrder.


git-svn-id: http://root.cern.ch/svn/root/trunk@48514 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-08 18:11:36 +00:00
Philippe Canal
b218b89d4c In the partial desugaring add support for the case where we have a type that point to an already completely desugared template instantiation in which case the type is a RecordDecl rather than a TemplateInstantationType
git-svn-id: http://root.cern.ch/svn/root/trunk@48510 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-07 22:56:10 +00:00
Axel Naumann
98960f8bb1 Add comment explaining read size of 512 bytes for file magic determination.
git-svn-id: http://root.cern.ch/svn/root/trunk@48501 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-07 13:14:26 +00:00
Axel Naumann
8bdaaf26a7 From Bertrand: fixes for cygwin.
* The PE magic is not within the first 64 bytes (only the DOS "MK" is); need to read more to identify DLLs.
* Use Windows's EnumProcessModules() even on cygwin to enumerate the loaded libraries; needs a Windows library (psapi) to be linked in.
* Filter system libraries on Windows: ignore it if contains "/usr/bin/cyg" or the Windows install path.
* Don't export any symbols from clang and llvm, we don't need them outside libCore. Before, all symbols were exported leading to a symbol table overflow.


git-svn-id: http://root.cern.ch/svn/root/trunk@48500 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-07 13:11:08 +00:00
Philippe Canal
84e8217b0c Add forward declared class to the list of classes and mark them with 'fwd'
git-svn-id: http://root.cern.ch/svn/root/trunk@48455 27541ba8-7e3a-0410-8455-c3a389f83636
2013-02-01 20:58:10 +00:00
Philippe Canal
9b52eb38da Extent .class to print the class template instantiation (and specialization) which are often (always?) stored in the class template decl
git-svn-id: http://root.cern.ch/svn/root/trunk@48436 27541ba8-7e3a-0410-8455-c3a389f83636
2013-01-29 22:39:00 +00:00
Vassil Vassilev
a8c69889d7 Call Sema::ActOnEndOfTranslationUnit in order to complete the module import.
For example, if the module contained virtual classes Sema has to generate/update
the virtual tables and so on, exactly as we do after each incremental parse 
(IncrementalParser::ParseInternal)

Now we have the code generated for the inlines coming from a module, but due to
a bug in the current state of the modules it generates some declaration of
a function (declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32) nounwind),
which causes the jit to choke with "LLVM ERROR: Cannot select: intrinsic %llvm.ptr.annotation"


git-svn-id: http://root.cern.ch/svn/root/trunk@48406 27541ba8-7e3a-0410-8455-c3a389f83636
2013-01-24 10:54:57 +00:00