Commit Graph

18 Commits

Author SHA1 Message Date
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
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
Axel Naumann
315dfad70e Adapt to new default opt level.
As the default opt level decides which user-set opt levels cling will complain about, "control flow" changes were needed for the tests.
2017-11-07 19:44:33 +01:00
Vassil Vassilev
c912c9437d Switch back to O0.
We have a suboptimal behavior in the way cling optimizes code in O2 mode.
Disable it until the issue is understood and fixed.
2017-11-03 16:19:32 +01:00
Frederich Munch
7825094907 Fix test for CERN/master. 2017-06-23 10:44:12 +02:00
Frederich Munch
137e1a48af Cleanup test formatting. 2017-06-23 10:44:12 +02:00
Frederich Munch
522b5f491c Add support for multiple arguments in one pragma call. Add support for multiple styles: 2017-06-23 10:44:12 +02:00
Vassil Vassilev
8f257e74d3 Create a virtual file entry for each input line.
This is the only way not to confuse the diagnostics engine of upgraded clang.

Also, this gives us a few advantages:
  * We can compare more precisely the source locations of diagnostics;
  * We can merge the code completion code path which works with file entries;
  * We can rely better when specifying //expected-note-s in different files.
2017-06-08 10:29:13 +02:00
Axel Naumann
52d32de70c Add tests for #pragma cling optimize and .O 2017-04-12 15:44:35 +02:00
Frederich Munch
42971e42cd Lit: Add %mkdir, %rm, and %rmdir substitutions. 2017-02-21 16:34:19 +01:00
Frederich Munch
340f6b897b Fix setenv declaration for gcc on OS X. 2016-12-15 14:29:09 +01:00
Frederich Munch
bf3c8052d8 Windows: Fix various test failures. 2016-12-12 12:44:09 +01:00
Frederich Munch
d4aed2527d Add CLING_EXPORT macro. 2016-12-12 12:44:09 +01:00
Frederich Munch
52cd30dbef Lit: Add setenv transformation to use export/set on Unix/Windows. 2016-12-12 12:44:09 +01:00
Elisavet Sakellari
bfa9947c5a Implement search path cling pragma / ROOT macros (ROOT-7269). 2015-06-04 16:40:08 +02:00
Axel Naumann
c1cf9236c0 Also test error recovery from non-existing file. 2015-02-18 14:51:21 +01:00
Axel Naumann
1ffc20a6b2 Add a cling pragma handler. For now implement #pragma cling load(file)
Extremely handy for sources that require certain libraries to be loaded;
it's similar to MSVC's #pragma comment(lib"libToLink").
2015-02-18 14:51:21 +01:00