Commit Graph

4401 Commits

Author SHA1 Message Date
Bertrand Bellenot
e7ae55720e Fix a crash when using an undeclared identifier (Jira #ROOT-10193) 2019-09-24 15:14:12 +02:00
Vassil Vassilev
1a1a84dfcb Ignore import decls to delay the running module inits.
If we preload modules using cling::Interpreter::loadModule the
deserializations of the module initializers (such as global variables).

We want the behavior of clang::Sema::ActOnModuleImport, however, it requires
valid source locations.

This patch ignores the ImportDecls which presumably came from loadModule.
2019-09-20 13:14:06 +02:00
Axel Naumann
2c92b57062 Try to fix Issue #289, #302, #297: only build cling, not lli. 2019-09-18 08:44:45 +02:00
Vassil Vassilev
63e0a871c1 Quote the imported module.
In some cases we have dict.C which the modules system considers as two
components: one top-level module and one submodule.
2019-09-14 22:59:04 +02:00
Vassil Vassilev
d66199f99f Reland "[cxxmodules] Use common-rooted valid source location."
Original commit message:
"Over the years we have a pathological issue with cling when it calls directly
compiler API. Most of the API assume they are called from code residing in a
text file. This code has valid source locations which can be used for
comparisons and things like point of instantiation for template instantiations.

This means that whenever a clang API requires a valid source location, cling
should have an interface which gives a pseudo-valid, commonly-rooted unique
source location.

We are bitten by this fact when preloading modules as if we have diagnostics
they cannot be ordered due to the fact that the compared decls from two
different modules do not have a common includer.

This patch avoids using an API and relies on a textual form which does not have
this problem at the cost of synthesizing an extra string."
2019-09-14 07:59:43 +02:00
Axel Naumann
646ccb8b9c Enable warnings for cling, disable them for llvm. 2019-09-10 16:29:09 +02:00
Axel Naumann
5446ed5a48 Allow /clang-7" -cc1 to ge found. 2019-09-10 16:29:09 +02:00
Axel Naumann
c7b980caf3 Use xcode10 image to find _stdio.h:
See https://patchwork.kernel.org/patch/10767419/
2019-09-10 16:29:08 +02:00
Philippe Canal
bd472f9b0a Clang-formatting 2019-09-09 19:15:34 +02:00
Philippe Canal
8b906da196 Expand StartParsingRAII
In particular the CachedTokens need to be pushed/pop or otherwise
give misleading information.

This fixes ROOT-10224.
2019-09-09 19:15:34 +02:00
Vassil Vassilev
1a53d8241d Revert "[cxxmodules] Use common-rooted valid source location."
This reverts commit 03febcbd899610de1188886a132fe78c804d3a00.

This commit broke the modules bots. Investigating...
2019-09-04 15:14:06 +02:00
Vassil Vassilev
b47bbaf546 Use common-rooted valid source location.
Over the years we have a pathological issue with cling when it calls directly
compiler API. Most of the API assume they are called from code residing in a
text file. This code has valid source locations which can be used for
comparisons and things like point of instantiation for template instantiations.

This means that whenever a clang API requires a valid source location, cling
should have an interface which gives a pseudo-valid, commonly-rooted unique
source location.

We are bitten by this fact when preloading modules as if we have diagnostics
they cannot be ordered due to the fact that the compared decls from two
different modules do not have a common includer.

This patch avoids using an API and relies on a textual form which does not have
this problem at the cost of synthesizing an extra string.
2019-09-04 12:44:07 +02:00
Axel Naumann
debe179515 Force brew update, it says it is outdated. 2019-09-03 14:29:07 +02:00
Axel Naumann
3821823ebd Spell "addons" correctly. 2019-09-03 12:14:33 +02:00
Axel Naumann
2e9481afe6 xenial has clang by default. 2019-09-03 12:14:33 +02:00
Axel Naumann
02407d4cb1 Use recommended brew setup. 2019-09-02 14:44:17 +02:00
Axel Naumann
ddd4ea0c32 Use more recent Xcode, replacing ancient 8.3. 2019-09-02 14:44:17 +02:00
Axel Naumann
48d216b260 GCC4.8 needs Ubuntu "trusty". 2019-09-02 14:44:17 +02:00
Axel Naumann
6a73fd08d2 Help ValuePrinter find the transaction:
If the ValuePrinter runtime header gets included,
a transaction might be emitted, and the transaction
containing the function body cannot be found anymore.
This causes roottest/root/meta/getFuncBody.C to fail
with runtime modules.
2019-09-01 09:15:17 +02:00
pankaj kumar
0c880f8472 Fixing the jupyter Kernel to be able to handle exceptions 2019-08-31 10:16:20 +02:00
Stephan Hageboeck
522a43fa0e Improve help message when .x fails.
A more informative warning is issued when a macro does not
contain a function to be called.
2019-08-26 18:29:18 +02:00
Javier Lopez-Gomez
a829d76c10 Fix SIGSEGV after executing the `.stats decl' metacommand 2019-08-16 16:59:04 +02:00
Vassil Vassilev
46a3a048b7 Bump version to 0.7~dev. 2019-08-16 09:14:06 +02:00
Vassil Vassilev
82ac7bf187 Prepare for releasing cling v0.6. 2019-08-16 08:29:30 +02:00
Guilherme Amadio
0d3fb9dbf4 Simplify query for include directories
- Use only sed instead of awk and grep
- Use regex independent of locale settings
2019-08-14 14:59:45 +02:00
Guilherme Amadio
111fa41390 Add assertion to ensure that page_size is a power of two 2019-08-08 18:14:03 +02:00
Nikita Ermakov
4b61a2134b Little optimization for the cling pointer check.
Use precalculated PAGE_MASK which is equals to ~(page_size - 1) at
pointer check instead of recalculate it each check.
2019-08-08 17:14:46 +02:00
Guilherme Amadio
0c6588cd0c Fix cling valid pointer check
Assuming that page_size is a power of 2, the calculation of the
base address of the page can be simplified and avoid a division.

According to POSIX, either MS_SYNC or MS_ASYNC must be specified
when calling msync(). Failure to include one of these flags will
cause msync() to fail on some systems.

When msync() returns -1, the pointer is only considered invalid
when errno is set to ENOMEM. In principle, the other possible
values for errno won't happen, but if they do, that should be
considered an error, hence the assert condition needed an update.
EBUSY shouldn't happen since we do not add MS_INVALIDATE to flags,
and EINVAL shouldn't happen because we always pass a multiple of
the page size to msync(). EFAULT is only used in Linux 2.4.18 and
earlier instead of ENOMEM.
2019-08-07 16:29:14 +02:00
Nikita Ermakov
d1faf4e905 Change pointer check method to msync.
The POSIX does not contains /dev/random [1]. Moreover the /dev/random
might not have write permissions. The better way is to use an another
solution which is based on the msync system call [2]. Also this solution
reduces the number of context switching.

[1] -- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap10.html
[2] -- https://pubs.opengroup.org/onlinepubs/009695399/functions/msync.html
2019-08-06 19:59:22 +02:00
Raphael Isemann
8446b953c2 Rename stl module to std
libc++ comes with a builtin modulemap and is using "std" as the
module name for the STL. To stay consistent we should use the same
name (and "std" is anyway a better name).
2019-07-25 17:59:15 +02:00
Bertrand Bellenot
8352541d0a Remove the -DUNICODE and -D_UNICODE definitions on Windows
Don't use Unicode in the User Interface (command prompt), it has side effects (the prompt displays empty squares instead of readable characters)
2019-07-22 11:14:11 +02:00
Vassil Vassilev
a63b8f1ec7 Mark library search paths system and user accordingly.
We have user library search paths which come from LD_LIBRARY_PATH or similar;
and system library search paths which are coming from the platform.

This patch enables external users performing symbol resolution to filter out
system search paths when they know the symbol cannot be there.

Now, TClingCallbacks can merge the modules vs non-modules code paths, where
the modules prebuilt path is essentially our LD_LIBRARY_PATH.
2019-07-18 20:59:17 +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
Axel Naumann
a3f236fe36 Use canary bytes to determine whether to run dtor:
If the constructor of the contained object is not run (e.g. because
assembling its arguments triggered an exception), the dtor must not
be run when destructing the cling::Value. Detect this case by imprinting
canary bytes into the contained object bytes: if they have changed,
run the dtor, if not assume that the constructor has failed.

This will cause false positives in those cases where the constructor
is not modifying the first object bytes: in these cases, the dtor
is not run even though the ctor is run. That is still better than
the other case (where the dtor crashes because no ctor was run).
2019-07-11 14:44:14 +02:00
Vassil Vassilev
da626b392d Teach ACLiC to build modules.
ACLiC now synthesizes a modulemap with a suffix _ACLiC_dict.modulemap. The file
contains the source file to be compiled and the corresponding library.

The modulemap is then passed to rootcling via -fmodule-map-file= flag to avoid
naming clashes with possibly existing other modulemap files.

This patch teaches cling to work with the -fmodule-map-file= flag.

ACLiC supports automatic inclusion of Rtypes.h (making ClassDef macro
available). Modules are built in isolation and are resilient to #include
of Rtypes.h at rootcling startup time. We make module Core (containing Rtypes.h)
visible via a newly implemented callback.
2019-07-01 13:59:14 +02:00
Axel Naumann
70df14a1c7 Create transactions only if codegen (not rootcling):
The transactions are useful to buffer Decls before sending them to CodeGen,
to verify semantic validity before emitting. If there is no codegen,
DeclCollecting them wastes CPU cycles during PCH generation time
because all headers are in one single transaction. Of course this also
speeds up regular rootcling invocations.
2019-06-28 23:59:17 +02:00
Axel Naumann
8f20c8c6a1 Remove unnecessary include (NFC). 2019-06-28 23:59:17 +02:00
Axel Naumann
ab8fcc633a Remove default-by-tokens default ctor (NFC). 2019-06-28 23:59:17 +02:00
Vassil Vassilev
74685d3725 Store rdict files as module file extensions.
This patch moves the ROOT-specific rdict.pcm optimization in the EXTENSION_BLOCK
of a C++ module file.

This reduces the generated artifacts and simplifies the loading of a rdict pcm
file as it is now part of the C++ module file. This patch paves our way to
using the global module indexing.
2019-06-19 18:59:07 +02:00
Philippe Canal
ddffe49bea Insure that the commit callbacks don't change the 'current' transaction.
This should solve the problem we have been seeing with cmsUnload.  The problem stems from the fact that TCling::AutoParseImplRecurse
uses the address of the current transactions has an index/key when registering a class in fTransactionHeadersMap.

On some platforms TInterpreter.h is parsed late, i.e. during the compilation of:

   gInterpreter->AutoParse("SiStripCluster");

consequently (as AutoParse does not create its own transaction), the transactions that contains
the parsin of TInterpreter is the last one committed before AutoParseImplRecurse is executed.

Without the parsing of TInterpreter.h then that transaction is return by fInterpreter->getCurrentTransaction().
With the parsing of TInterpreter.h, during the commit of the transaction of the callbacks are triggered
and one of the decl is a constant (kFALSE) and thus, in TCling::HandleNewDecl, provokes the execution of

       if (gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
         return;

which will triggered the creation of a Transaction, however since the last top level transaction was
just switch to the state 'Committed', the new transaction will not be nested and thus
IncrementalParser::endTransaction will set the current transaction to 'nullptr'.

And this value of nullptr for the key of fTransactionHeadersMap is neither guaranteed to be unique
nor handled properly by the rest of the code.

It is unclear why this problem have surfaced recently.

On a failing machine, rebuilding with a 2 month old commit (ad9e5c42cb) still exhibits the problem.
2019-06-07 08:29:45 +02:00
Philippe Canal
0c50779a5f Transaction::clear add missing m_DeserializedDeclQueue.clear 2019-06-07 08:29:45 +02:00
Vaibhav Garg
43b3232b82 Fixing order of options 2019-06-05 09:59:31 +02:00
Vaibhav Garg
b34d634a52 Rename Cling's flag -modulemap_overlay to -includedir-loc 2019-06-05 09:59:31 +02:00
Vassil Vassilev
81e2eda009 Check if the triggerFunc is in a library.
This patch should fix an assert in the incrementals.
2019-06-03 15:44:13 +02:00
Vassil Vassilev
d71643dcf8 Support recursive lookup helper calls.
The implementation of class->library mapping makes a call to the
LookupHelper::findScope. This makes the recursive invocations to
LookupHelper::findScope -> ... -> LookupHelper::findScope happen more often.
2019-06-02 21:44:26 +02:00
Vassil Vassilev
d5163b6290 Do not allow single line if statements. 2019-05-31 11:29:15 +02:00
Axel Naumann
ed64547947 Support trailing semicolon in .x foo.C(12); 2019-05-15 21:14:11 +02:00
Axel Naumann
202a2c8e89 Improve .x arg parsing (ROOT-10097):
Dropbox folders (among others) can contain parentheses.
Without this patch, ROOT and cling misinterpret those directories as arguments.
Instead, first find the end of the ".x" line.
If the previous token was a closing paren, we assume that the preceding
tokens (up to the non-nested opening paren) belong to the argument.
2019-05-15 21:14:11 +02:00