Commit Graph

650 Commits

Author SHA1 Message Date
Axel Naumann
2b1af22926 In failed lookup, unload only decls produced, not existing fwd decl:
Before, pre-existing fwd decls of specializations got unloaded.

OTOH, any decl produced during (failed) template instantiation must
also be unloaded; see #6331. Those are easiest identified by unloading
the whole (failed) transaction.

```
error: no member named 'value' in 'std::__and_<std::is_copy_assignable<std::__cxx11::basic_string<char> >, std::is_copy_assignable<Inner<int> > >'
                       is_copy_assignable<_T2>>::value,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

which is due to the first decl being invalid (as `Inner<int>` does not have a deinition and a `static_assert` /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/type_traits:1093 being triggered), then not unloaded, and then picked up again where we *do* have the definition for `Inner<int>`.

Add test for templt spec lookup vs unloading.
2021-03-18 19:59:03 +01:00
Axel Naumann
b921ac814a Bring vanilla-cling lit feature back:
it is needed for test/Autoloading/AutoForwarding.C.
2021-03-16 09:59:04 +01:00
Axel Naumann
897701fb24 Help test find its parts:
was failing before but due to `REQUIRES: vanilla-cling` not run.
2021-03-16 09:59:03 +01:00
Axel Naumann
608a992e5f Fix expected diags in test/Pragmas/load.C:
A failure to load the library will *not* trigger loading the
same file as a source file: `#pragma load` will cause zero or
one diagnostics, not two.

Now that the diagnostic for a missing file to be `#pragma load`ed
is "file not found", re-use the existing `expected-error@input_line_12`
line!.
2021-03-16 09:59:03 +01:00
Simeon Ehrig
be5ea3a651 Fixed CUDA mode for Clang/LLVM 9 upgrade
- fix bug, which was caused by executing a transaction in the device
interpreter
- fixed warning from the device compiler
- update test cases
2021-02-25 20:44:19 +01:00
Axel Naumann
b118f4dee3 Get rid of extra-complex built_cling:
that is anyway what we want to test, always.
And nothing seems to set the env var.
2021-02-25 20:44:18 +01:00
Axel Naumann
ffc267b9dd Import updated lit config:
Copy and adapt lit.cfg from clang.
Export the CMake variable cling needs.
Add missing, now needed call to lit.llvm.initialize.
Remove unused "loadable_module" feature.
2021-02-25 20:44:18 +01:00
Vassil Vassilev
fa7c45b1ca Orc JIT now takes the ownership of the llvm::Module.
The old JIT infrastructure assumed shared ownership of the llvm::Module
implemented via shared_ptr. This guaranteed each client can have a uniform
view of the llvm::Module. The new infrastructure claims ownership of the object
and even more transfer ownership when the llvm::Module travels through different
layers of the JIT. The claimed advantage is better thread safety.

The new logic defines away an important property which cling has been built
around, that is the shared symbol object ownership.

This patch makes the cling::Transaction the owner of the llvm::Module. The
ownership is transfered when we want the JIT to 'emit' the module. Fortunately,
there is a JIT callback which can transfer back the ownership to the transaction.

This preserves some consistency, however, makes some operations unsafe. For
example, we cannot rely on Transaction::getModule when the module is being
handed to the JIT.

This patch tries to adapt to the new infrastructure by reducing the dependency
on the transaction's llvm::Module in favor of relying more on the information
available in the execution engine (eg. at_exit handling).
2021-02-25 20:44:17 +01:00
Vassil Vassilev
2d1a60d163 Drop support of #pragma cling load header.h
llvm-mirror/clang@444665e219 says:
"Remove use of lookahead from _Pragma handling and from all other

internal lexing steps in the preprocessor.

It is not safe to use the preprocessor's token lookahead except when
operating on the final sequence of tokens that would be produced by
phase 4 of translation. Doing so corrupts the token lookahead cache used
by the parser. (See added testcase for an example.) Lookahead should
instead be viewed as a layer on top of the normal lexer.

Added assertions to catch any further incorrect uses of lookahead within
lexing actions."

This tells us that if we try to #include the header.h while processing the
2021-02-25 20:44:17 +01:00
Vassil Vassilev
401fbfdf90 Check for the expected diagnostics. 2021-02-25 20:44:17 +01:00
Vassil Vassilev
3f8a2221ed llvm9 fixes the printing of unscoped enums.
See llvm-mirror/llvm@2f52311
2021-02-25 20:44:17 +01:00
Vassil Vassilev
c32df9ba67 auto func requires c++14 2021-02-25 20:44:17 +01:00
Simeon Ehrig
e47bb75f9f Allows to configure CUDA sm level for Cling CUDA tests
- the CUDA sm level can be set via CLING_TEST_CUDA_SM_LEVEL
environment variable (e.g. "35"), before running the tests
2021-02-18 09:29:04 +01:00
Pratyush Das
e978660f35 Remove dependence on svn
LLVM repository has migrated from svn to git
2021-02-16 22:29:03 +01:00
Simeon Ehrig
b2bfd6e19f Extend the cling-test to deal with CUDA SDKs that are not in the default location
- To enable the CUDA test, lit detects the `libcudart.so` in
`LD_LIBRARY_PATH`. Now lit also set the CUDA SDK root of
`libcudart.so` as cling parameter (`--cuda-path`) in the tests.
- Pass through the environment variable `CUDA_VISIBLE_DEVICES`.
2021-02-10 15:18:14 +01:00
Jonas Hahnfeld
c7558a2c0d Reset function sections before JITting
This makes all functions end up in the same text section, which is
important for TCling on macOS to catch exceptions from constructors:
Stack unwinding requires information about program addresses to find
out which objects to destroy and what code should be called to handle
the exception. These addresses are relocated against a single __text
section when loading the produced MachO binary, which breaks if the
call sites of global constructors end up in a separate init section.

Fixes ROOT-10703 and ROOT-10962
2021-02-10 15:18:14 +01:00
Jonas Hahnfeld
173de1db30 Enable test for exceptions 2021-02-10 15:18:14 +01:00
Javier Lopez-Gomez
c054ac2840 added missing include in cling/test/CodeUnloading/DeclShadowing.C 2020-12-16 18:29:03 +01:00
Javier Lopez-Gomez
904796d2bb New interface to export Cling run-time configuration bits.
This commit allows the user to enable/disable specific interpreter capabilities
without requiring to `#include` the heavier weight `Interpreter.h` (that also
has dependencies on llvm).

The only feature covered at the moment is definition shadowing.

Closes cling issue #360.
2020-12-14 10:29:04 +01:00
Axel Naumann
dfb84fe995 Support GCC10 type name:
(std::pair<std::__strip_reference_wrapper<const char *>::__type, std::__strip_reference_wrapper<int>::__type>) { "s", 10 }
i.e. the array size is not part of the type.
2020-08-20 17:29:08 +02:00
Frederich Munch
06afb308e4 Report ValueExtractionSynthesizer errors with DiagnosticsEngine. 2020-08-20 09:44:06 +02:00
Axel Naumann
68ede76505 Remove fwddecl files; RUN: often fails. 2020-08-12 09:14:07 +02:00
Jonas Hahnfeld
f2b3a8408e IsClassOrFunction: Handle signedness modifiers
When using these modifiers, a type can consist of multiple tokens
as for example "unsigned int". However the keyword "int" can also
be omitted, making "unsigned" itself also a valid type.

Note that this only handles the most basic case for the modifiers.
The size modifiers "short", "long", and "long long" would need
similar treatment. Moreover the standard permits any order for the
type specifiers, ie "unsigned long long int" and "long int unsigned
long" are both valid (and actually the same type).
2020-07-01 22:44:08 +02:00
Axel Naumann
41dbc3be44 Add test for ROOT-10689. 2020-04-16 18:29:08 +02:00
Philippe Canal
7a5894d1b8 meta/cling: consistent casing for AutoLoading 2020-02-15 17:14:14 +01:00
Pratyush Das
bc70947c9a Fix broken vanilla-cling tests.
Change condition of adding vanilla-cling, change directory locations for
downloaded binary release.
2019-12-23 06:44:28 +01:00
Simeon Ehrig
ad8d5e1137 Changes for Pull Request #284
- add Author to CUDA test cases
- optimize DeviceKernelInliner
- improve some comments
- remove deprecated opt level variables
- change interface of IncrementalCUDADeviceCompiler::process() IncrementalCUDADeviceCompiler::declare()
2019-11-07 19:29:15 +01:00
Simeon Ehrig
f63b935c68 Refactor public interface of cling::IncrementalCUDADeviceCompiler
- it is more similar to the interface of cling::Interpreter
- replace function compileDeviceCode() with process()
- add declare() and parse() functions
- the functions have only the argument input, because the rest of the missing arguments (e.g. Transaction) requires modifications at the transaction system
- it also fixes a bug in the I/O system of the xeus-cling kernel
2019-11-07 19:29:15 +01:00
Simeon Ehrig
64fe3f7d6d Setting a new include path at runtime in the PTX compiler now works 2019-11-07 19:29:15 +01:00
Simeon Ehrig
0d9d8be5b9 Support for the define argument (-D) in the CUDA mode 2019-11-07 19:29:15 +01:00
Simeon Ehrig
2489cf13b1 Replaced incremental PTX compiler with a internal implementation
Replaced the old version of the PTX compiler which used external tools and llvm::ExecuteAndWait with an internal implementation. The new incremental PTX compiler uses a modified version of the cling::Interpreter instance. The instance can process the PTX built-ins and generates LLVM IR. The LLVM IR is be compiled to PTX via an additional NVPTX backend implemented in the IncrementalCUDADeviceCompiler.

The new implementation has many advantages:
- it's much faster than the old version
- less error-prone because the ASTPrinter and some unnecessary cling transformations are avoided
- reduction of problems in searching for external tools (can be very complicated on HPC systems)

The IncrementalCUDADeviceCompiler is moved from the cling::IncrementalParser to the cling::Interpreter, because the second interpreter needs the input without wrappers or transformations.
2019-11-07 19:29:15 +01:00
Simeon Ehrig
6c46b65754 Extend cling::Intpereter to incremental compile PTX code for CUDA devices
- change CUDA to CUDAHost and add CUDADevice to the InvocationOptions
- in the PTX mode, some ASTTransformer will not be used, which are useful for the x86 mode
2019-11-07 19:29:15 +01:00
Philippe Canal
4a92ac82a9 Don't use make_unique to be runnable in C++11 2019-10-05 14:59:03 +02:00
Philippe Canal
8339e5498e print the value of the pointer when value printing smart pointers.
This fixes ROOT-10333.

Since the printValue set of functions always takes a pointer and dereferences it without any checks,
the previous implementation was attempting to valuePrint the pointee (rather than the pointer value)
but this lead to a segmentation fault whenever the smart pointer was set to nullptr.

Now, the valuePrinting for the smart pointers behaves the same as for regular pointer.
2019-10-05 13:59:26 +02:00
Javier Lopez-Gomez
699583cdf0 DefinitionShadower: minor fix to test/CodeUnloading/DeclShadowing.C 2019-10-04 10:29:22 +02:00
Javier Lopez-Gomez
fc63a9f205 DefinitionShadower: added test/CodeUnloading/DeclShadowing.C 2019-09-27 14:59:06 +02:00
Axel Naumann
ba4cc7641e Add test for ROOT-10221. 2019-07-16 00:14:07 +02:00
Axel Naumann
be780f4812 Fix initialization of array, fixes test. 2019-07-15 21:14:05 +02:00
Axel Naumann
4fef27091e Add storage to test types, to trigger dtor call. 2019-07-15 17:29:08 +02:00
Vassil Vassilev
daeaa6d9fb Fix failing test. 2019-03-17 08:15:02 +01:00
Vassil Vassilev
0b9abc1e14 Force flush cout after execution
The user might use utilities which print on cout and expects the output
to be shown immediately.

This patch automatically flushes std::cout after each execution of a wrapper.
2019-03-16 14:29:29 +01:00
Axel Naumann
76fac41c28 test lookup of template function specialization (ROOT-9789). 2019-01-10 13:29:15 +01:00
Vassil Vassilev
5789f5b2eb Build clingDemoPlugin when testing. 2018-11-21 17:15:14 +01:00
Yuka Takahashi
80fa13b41e Fix print.C
Remove semicolon to print out
2018-10-12 14:30:16 +02:00
Yuka Takahashi
d77a3252dc Fix print.C
ToString takes typename and an object pointer
2018-10-12 08:44:07 +02:00
Yuka Takahashi
53476daf4b Fix printing test in Cling
Testsuit was actually looking at '"' for match, comparing literal 21
should be enough.
2018-10-10 14:59:07 +02:00
Vassil Vassilev
38eb2b89ba Allow plugins to handle custom pragmas.
This will help clad implement pattern such as:
#pragma clad on
// code which needs derivation
#pragma clad off
2018-10-08 21:44:55 +02:00
Yuka Takahashi
9c7abadde0 Implement toString interface to gInterpreter
This is the final version of "printValue" discussion.

We agreed that printValue interface should be altered to ToString
interface, which can be invoked `gInterpreter->ToString(XYZ)`. (ToString is in TCling and toString is in Interpreter :D)

This patch contains:

- Implementation of toString in Interpreter.cpp
- Re-Implementation of ClingPrintValue to use ToString because I changed to use Evaluate some time ago.
- Removing of RVec version of printValue which wasn't used at all
- Fix test/vecops_rvec.cxx, printValue is never supposed to be called by a normal user.
2018-10-04 17:13:34 +02:00
Danilo Piparo
a9160b6374 Fix tag lookup test 2018-09-24 09:58:50 +02:00
Danilo Piparo
f2b6205182 Remove fatal typo in tag lookup tests 2018-09-24 09:13:47 +02:00